Hi Korey,

Are you aware of Param.Enum()?  It's a much cleaner way to implement
the string-based switch thing you have below.  I'm not sure it's
documented anywhere, but see MemoryMode in sim/System.py and OpClass
in cpu/FuncUnit.py for examples.

Steve

On Thu, Oct 1, 2009 at 1:08 PM, Korey Sewell <[email protected]> wrote:
> # HG changeset patch
> # User Korey Sewell <[email protected]>
> # Date 1254427252 14400
> # Node ID 10f28313968a81a4ae5e149d4c30f0c463e3d0de
> # Parent  554c1e5bd379794a13561fdf021c4d723ed00a1c
> inorder: add threadModel param
>
> diff --git a/src/cpu/inorder/InOrderCPU.py b/src/cpu/inorder/InOrderCPU.py
> --- a/src/cpu/inorder/InOrderCPU.py
> +++ b/src/cpu/inorder/InOrderCPU.py
> @@ -35,6 +35,8 @@
>     type = 'InOrderCPU'
>     activity = Param.Unsigned(0, "Initial count")
>
> +    threadModel = Param.String("SMT", "Multithreading model (SE-MODE only)")
> +
>     cachePorts = Param.Unsigned(2, "Cache Ports")
>     stageWidth = Param.Unsigned(1, "Stage width")
>
> diff --git a/src/cpu/inorder/cpu.cc b/src/cpu/inorder/cpu.cc
> --- a/src/cpu/inorder/cpu.cc
> +++ b/src/cpu/inorder/cpu.cc
> @@ -188,7 +188,7 @@
>       deferRegistration(false/*params->deferRegistration*/),
>       stageTracing(params->stageTracing),
>       numVirtProcs(1)
> -{
> +{
>     ThreadID active_threads;
>     cpu_params = params;
>
> @@ -207,6 +207,18 @@
>               "in your InOrder implementation or "
>               "edit your workload size.");
>     }
> +
> +    if (active_threads > 1) {
> +        std::string smt = "SMT";
> +        std::string switchOnCacheMiss = "SwitchOnCacheMiss";
> +
> +        if (smt.compare(params->threadModel) == 0) {
> +            threadModel = SMT;
> +        } else {
> +            threadModel = SwitchOnCacheMiss;
> +        }
> +    }
> +
>  #endif
>
>     // Bind the fetch & data ports from the resource pool.
> diff --git a/src/cpu/inorder/cpu.hh b/src/cpu/inorder/cpu.hh
> --- a/src/cpu/inorder/cpu.hh
> +++ b/src/cpu/inorder/cpu.hh
> @@ -99,6 +99,15 @@
>     /** Type of core that this is */
>     std::string coreType;
>
> +    // Only need for SE MODE
> +    enum ThreadModel {
> +        Single,
> +        SMT,
> +        SwitchOnCacheMiss
> +    };
> +
> +    ThreadModel threadModel;
> +
>     int readCpuId() { return cpu_id; }
>
>     void setCpuId(int val) { cpu_id = val; }
> @@ -116,7 +125,6 @@
>
>     /** Overall CPU status. */
>     Status _status;
> -
>   private:
>     /** Define TickEvent for the CPU */
>     class TickEvent : public Event
> diff --git a/src/cpu/inorder/inorder_cpu_builder.cc 
> b/src/cpu/inorder/inorder_cpu_builder.cc
> --- a/src/cpu/inorder/inorder_cpu_builder.cc
> +++ b/src/cpu/inorder/inorder_cpu_builder.cc
> @@ -51,7 +51,8 @@
>
>     if (workload.size() == 0) {
>         fatal("Must specify at least one workload!");
> -    }
> +    }
> +
>  #endif
>
>     numThreads = actual_num_threads;
> diff --git a/src/cpu/inorder/params.hh b/src/cpu/inorder/params.hh
> --- a/src/cpu/inorder/params.hh
> +++ b/src/cpu/inorder/params.hh
> @@ -53,6 +53,8 @@
>  #if !FULL_SYSTEM
>     std::vector<Process *> workload;
>     Process *process;
> +
> +    std::string threadModel;
>  #endif // FULL_SYSTEM
>
>     //
> _______________________________________________
> m5-dev mailing list
> [email protected]
> http://m5sim.org/mailman/listinfo/m5-dev
>
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to