Part 1 (80 points) Simulator
Overview
In this assignment, you will extend your simulator to support fine-grained MT.
We need multiple steps to support the MT feature.
Adding MT feature requires modifications in multiple places in the simulator.
Additional data structures must be added. add_me4.txt file and lab4.tar.gz (contains only knobs for the time being)
are provided
First, you need to make the simulator run correctly right after you add add_me4.txt file. add_me4.txt file changes get_op function and adds thread_id into op_struct, additional knobs and modify stat prints. You need to convert your stat data structures to be arrays.
(Note: use HW_MAX_THREAD to convert a scalar variable to an array variable. i.e.) dcache_miss_count --> dcache_miss_count[HW_MAX_THREAD].
The difference between HW_MAX_THREAD and KNOB_RUN_THREAD_NUM is that HW_MAX_THREAD is the maximum number of threads that the hardware can support and KNOB_THREAD_NUM is the number of running threads at a given time. The hardware can support 4 threads but a user can decide to run 1 ~ 4 threads. )
Because now the system handles multiple traces, before you add MT feature, you need to make it sure
that your simulator still runs one thread just like before and then you add features to support multi traces.
In a real architecture simulator, simulation ending condition should be more sophisticated. However, in this assignment, we do not change the ending conditions. Therefore, simulator reads from only remaining traces until all the traces are finished. max_inst_count is based on the sum of all threads.
if (bp_corr) { bp_corr_predict++; bp_corr_predict_thread[op->thread_id] = bp_corr_predict_thread[op->thread_id]+1; }
SOLUTION: Address 0x52 falls under block 0x5 Address 0x448 falls under block 0x44 Addresses 0x450 and 0x452 falls under block 0x45 Addresses 0x850 and 0x852 falls under block 0x85 Address 0x1850 falls under block 0x185 All addresses have tag: 0x0 For the given sequence of LDB, STB operations, the following MSI protocol operations occur: P0: LDB 0x450
P0.B45: (S,0,0x0)
P0: STB 0x448 -> 0x4
P0.B44: (M,0,0x4)
P1: STB 0x450 -> 0x5
P0.B45: (I,0,0x0) | P1.B45: (M,0,0x5)
P1: LDB 0x450
P1.B45: (M,0,0x5)
P1: STB 0x448 -> 0x6
P1.B44: (M,0,0x6) | P0.B44: (I,0,0x4)
P0: LDB 0x450
P0.B45: (S,0,0x5) | P1.B45: (S,0,0x5)
P0: LDB 0x052
P0.B5: (S,0,0x0)
P0: STB 0x452 -> 0x7
P0.B45: (M,0,0x7) | P1.B45: (I,0,0x5)
P0: STB 0x852 -> 0x8
P0.B85: (M,0,0x8)
P0: LDB 0x1850
P0.B185: (S,0,0x0)
P1: LDB 0x850
P1.B85: (S,0,0x8) | P0.B85: (S,0,0x8)
P1: LDB 0x450
P1.B45: (S,0,0x7) | P0.B45: (S,0,0x7)
Final Cache Entries are: Processor 0 B5 :- State: Shared, Tag: 0x0, Data: 0x0, Index: 0x5 B44:- State: Invalid, Tag: 0x0, Data: 0x4, Index: 0x44 B45:- State: Shared, Tag: 0x0, Data:0x7, Index: 0x45 B85:- State: Shared, Tag: 0x0, Data: 0x8, Index: 0x85 B185:- State: Shared, Tag: 0x0, Data: 0x0, Index: 0x185 Processor 1 B5 :- State: Invalid, Tag: 0x0, Data: 0x0, Index: 0x5 B44:- State: Modified, Tag: 0x0, Data: 0x6, Index: 0x44 B45:- State: Shared, Tag: 0x0, Data: 0x7, Index: 0x45 B85:- State: Shared, Tag: 0x0, Data: 0x8, Index: 0x85 B185:- State: Invalid, Tag: 0x0, Data: 0x0, Index: 0x185