A Wombat Performance Simulation
- I would like to build a spreadsheet to model WOMBAT.
- First build a table of the basic components of the machine and their time.
- Use an abbreviation for each unit (ALU, BUS, CU, MEM, REG)
- REG is for all registers, assume the load time is the same.
- BUS is the time to put something on the bus
- ALU is just the performance for + and -, we may expand this later.
- This list needs to be ascending for what we will do later.
-
- I will group the instructions into classes
- Class I, read/write
- Class II, load/store
- Class III, Math instructions
- Class IV ADDI
- Class V Jump
- Class VI conditional jump
- Class VII Indirect instructions
- One a second worksheet, I want to compute the time for each class of instruction.
- Start with FETCH, this is not an instruction but a common computation
- Fetch requires the following steps:
- BUS ← PC (BUS)
- MAR ← BUS (REG)
- MDR ← M[MAR] (MEM)
- BUS ← MDR (BUS)
- IR ← BUS (REG)
- So I set up the following table:
-
- Filling in the individual time i used the vlookup function
- This will find a value in a table.
- In this case, look for the time from the previous table.
- Index by the Operation name
- And return the second column.
- =vlookup(C5, Main.A$2:B$6,2)
- Drag this down to the other cells to look up all of the times.
- Finally total all of these with the sum function sum(d5:d9)
-
- Do the same for the decode portion of the cycle.
- Compute the time for class I
- Just the execute portion
- BUS, REG (or REG, BUS) but this does not matter)
- Remember to add the Fetch and Decode stages into the total
-
- Repeat for all other classes of instruction.
- Copy the values (as a =cell) from the work sheet back to the main sheet.
- Calculate cycles per instruction
- In a cell label and place the period of the clock.
- I will use 100, but we will change this.
- Add a cycles column to the table.
- Instructions must take a whole number of cycles
- =roundup(time/clocklength)
- Add a column to compute the unused portion of the clock
- =roundup(cycles*clocklength-time)
-
- Note, this step is somewhat unrealistic, as we need to be more careful where we break the clock cycle, but it will do for now.
- The performance of a program.
- The next thing we need to add is how many times each instruction is used in a program.
- This will depend on several things.
- The task to be performed
- The instructions selected by the programmer/compiler/assembler/...
- For now, I will make up an instruction mix
- We could gather a better mix using a simulator.
-
- Next compute the number of instructions used for each class
- Add a constant that represents the number of instructions in the program.
- And multiply this by the frequency for each class.
- Compute the cycles by multiplying the frequency by the cycles for each class
- And compute the time by multiplying the cycles by the clock rate.
-
- Find the total time, and convert this to seconds (divide by ns/sec)
- Find the clock rate and convert this to MHz.
-
- My worksheet is here