nkanderson / ECE585-llc

Simulation of a last level cache (LLC) for ECE 585 final project
0 stars 0 forks source link

Read and parse input file #1

Closed nkanderson closed 1 day ago

nkanderson commented 4 days ago

Working code to read and parse an input trace file (the name of which is specified by the user) with correct default if none specified

From the final project doc: Your testbench must read events from a text file of the following format. You should not make any assumptions about alignment of memory addresses. You can assume that memory references do not cross cache line boundaries. n address where n is 0 read request from L1 data cache 1 write request from L1 data cache 2 read request from L1 instruction cache 3 snooped read request 4 snooped write request 5 snooped read with intent to modify request 6 snooped invalidate command 8 clear the cache and reset all state 9 print contents and state of each valid cache line (doesn’t end simulation!)

The address will be a hex value (without leading 0x). For example: 2 408ed4 0 10019d94 2 408ed8 1 10019d88 2 408edc

So my interpretation is that we'll want a dictionary mapping the event code (0-9) to the description, from the list above. The file itself will have an event code and a hex address (no leading zeros). For the demo, maybe we should simply output the full hex address (32 bits in hex) and the event description.

We need to allow for a user-specified input file, and provide a default if the user does not provide a file.

reecewayt commented 4 days ago

Trace file follows a specific format, for example: [operation_code] [memory_address] 2 408ed4 # This means: "Instruction fetch (code 2) from memory address 408ed4" 0 10019d94 # This means: "Data read (code 0) from memory address 10019d94"

reecewayt commented 1 day ago

Done