Simulation is performed in order to give insight to problems which cannot be efficiently analyzed via an analytical approach. The objective of this assignment is use our 'arbiter' and 'cpu' entities provide some quantitative answers to issues in an 8 CPU system that utilizes different features of the arbiter. This lab is worth 150 pts.
ROUND_ROBIN :boolean := TRUE; -- do round_robin priority if true -- else do Fixed priority OVERLAP_GRANT :boolean := TRUE; -- overlap grant requests if true -- else do NON-OVERLAPPED grant request.
In a fixed prority scheme, the priorities assigned to bus request lines to resolve simultaneous requests never change. In this arbiter, bus request #0 has the highest priority, bus request #7 has the lowest. In a round robin scheme, the priorities are rotated after every bus transfer with the goal of giving each request line equal time at being the highest priority.
The OVERLAP_GRANT generic controls whether or not the arbiter will perform overlapped bus requests. An overlapped bus request is when the arbiter grants the bus to a CPU while a different CPU still has ownership of the bus. Using overlapped grants minimizes the bus ownership transfer time between CPUs (minimizes the number of cycles that BBUSY goes to a 'H' during bus ownership transfer).
Use an 8 CPU simulation, and answer the following questions:
To determine the answers to the above questions, you will need to do an 8-CPU+Arbiter simulation in which the CPUs make IO transfers. There must be some method of controlling the number of requests that a CPU makes in a period of time (the 'rate' of IO requests) in order to create different levels of bus utilization (the more requests the CPUs make within a period of time, the higher the bus utilization). The exact bus utilization will depend on the number of CPUs, the IO activity by the CPUs, and the size of the transfers when a CPU assumes control of the bus. You will also need to track statistics for each CPU and on a global basis. One statistic you will need to keep for each CPU is the number of IO transfers made by the CPU over the simulation, and also the average bus latency per transfer. An example of a global statistic is the total number of clocks or the total number of clocks in which the BBUSY line is asserted.
I have included in the ZIP archive a CPU model that follows the bus protocol defined in simulation #2. Various generics have been added to the CPU model for the purposes of this simulation. Please use this model instead of the one wrote for simulation #2 so that I know that everybody is starting from the same point. The generics on the CPU model are explained below:
The testbench file 'tb_cpu8' instantiates an arbiter with 8 CPU components. Make whatever modifications are necessary to the provided models in order produce the statistical information required in the following section.
If implemented as specified above, you should find that varying the request rate from 0 to 60 is more than adequate to achieve 0 to maximum bus utilization. How you choose to vary the request rate and in what steps is up to you.
You can answer the required questions by plotting:
# CPU #0 Total Clks: 10000, Total IOs: 25, Total Latency: 57, LatencyPerIO: 2.280000e+00
# CPU #1 Total Clks: 10000, Total IOs: 24, Total Latency: 78, LatencyPerIO: 3.250000e+00
# CPU #2 Total Clks: 10000, Total IOs: 24, Total Latency: 55, LatencyPerIO: 2.291667e+00
# CPU #3 Total Clks: 10000, Total IOs: 24, Total Latency: 64, LatencyPerIO: 2.666667e+00
# CPU #4 Total Clks: 10000, Total IOs: 24, Total Latency: 59, LatencyPerIO: 2.458333e+00
# CPU #5 Total Clks: 10000, Total IOs: 22, Total Latency: 107, LatencyPerIO: 4.863636e+00
# CPU #6 Total Clks: 10000, Total IOs: 24, Total Latency: 63, LatencyPerIO: 2.625000e+00
# CPU #7 Total Clks: 10000, Total IOs: 24, Total Latency: 57, LatencyPerIO: 2.375000e+00
# TransferSize: 8 ReqRate: 5 %BusUtil: 15% AvgIOs: 23 AvgTotalLatency: 67 AvgLatencyPerIO: 2.913043e+00
One way to keep the statistics is to define a package that has some global counters in it for each CPU (you can assume that there will be only 8 CPUs). After the 'active' line goes to an 'H', the stimulus module can call a 'report' procedure which you have placed in this package; the 'report' procedure prints the statistics to standard output (use a 'writeline' function to file OUTPUT);
Please do some simple sanity checking on your statistics. For example, you can't get a bus utilization > 100 %. The maximum bus utilization for overlapped grant operation is ( (transfer_size)/(transfer_size+1))*100%. For very low request rates where there is little bus contention, the Latency per IO should be 2 or very close to this. For very low requests rates, you can estimate the number of IOs made by each CPU as (Total Clocks)/2000 * Req_Rate . For very low bus request rates, the %bus utilization will be close to (Number_of_IOs * Transfer_size * Number_of_CPUs)/Total_Clocks*100%.
From the directory above your 'sim3' directory (your should be in the 'src' directory of your VHDL development tree), execute the script submit_sim3.pl . This will create a compressed tar file of your 'sim3' directory and will mail it to me.
Two of the files I have placed in the ZIP archive are called 'sim3/cfg_tb.template' and 'sim3/cfg_tb.vhd'. The 'cfg_tb.vhd' file uses the testbench provided in 'tb_cpu8.vhd'.
The perl script 'sim3_sol.pl' in ZIP archive uses the 'cfg_tb.template' file to run a series of VHDL simulations, varying the GENERICS above and recording your model output to a file. Look at the comments in the Perl script to determine how to run the perl script, and specify the parameters for each run. Once you have run the simulations, you can extract the data from the log file and produce your graphs (you might want to write another perl script that extracts this data and produces the plots automatically - I will leave this up to you).
When you submit your simulation, name your Makefile as 'Makefile.sim3' and place it in your sim3 submission directory. I do not care how many new VHDL packages/entities/configurations that you add to the original files I give you or how you modify the entities/packages which are already there. I just want your code to be compatible with the 'cfg_tb.vhd' configuration I have provided, and I want to be able to execute your 'Makefiles/Makefile.sim3' to recompile your code. If you do not provide this, I can't grade your simulation and you will receive no credit. Be sure your makefile runs from a 'clean compile' - i.e., no timestamps present in the timestamp obj/qhdl/sim3 directory.
I will use your models with my own parameters for REQ_RATE, TRANSFER_SIZE, etc and look at your model output to see if it makes sense. I do not expect your numbers to match my numbers exactly - however, I do expect approximate agreement.
In your submission include a report file ('sim3/report.pdf') that has the requested graphs, and the answers to the questions. You will need to justify the answers to your questions via either the graphs or numerical output from your simulation. If you need to produce additional graphs that have expanded views in the area of interests to justif your answers, then do so. If you do not justify an answer, it will be counted as wrong. I expect answers significant to only one decimal point (ie. 3.6 is ok, but "about 4" is not acceptable).