Hello all, I'm new to gem5 and I'm trying to use it as a simulation environment 
for a RISC-V related project. I'll first ask my questions, and if there are any 
confusions as to what I'm trying to achieve please see description below. Any 
help or response is much appreciated!
1) For the MinorCPU model, how does gem5 know how many clock cycles an 
instruction's execution would take? For instance, in most microarchitectures, 
the instructions ADDI, MUL and DIV would all take different number of cycles to 
execute. Where is timing information for this set? Digging into the code a bit, 
I've noticed there is a class called MinorFUTimings where some timing 
properties can be set for a functional unit which seems like the answer to my 
question, but I couldn't find anything that indicates this is used for each 
standard instruction to adjust their timings. There is likely a more systematic 
way this is managed, which makes more sense of course, but I wasn't able to 
figure it out after looking through the documentation on Minor CPU model and 
the source code.
2) Seeing as the CPU models in gem5 span all ISAs, I'm assuming these models 
don't necessarily reflect any particular microarchitecture's details. Is there 
any difference between the MinorCPU when I build gem5 for RISC-V vs. x86? 
Especially pertaining to this timing information I mentioned in my first 
question. How does gem5 know, for instance, how many cycles a simple multiply 
with register operands would take for RISC-V vs. x86, both with the MinorCPU 
model?
3) What would be the best way to get information on time spent in functions 
when running gem5 in SE mode for RISC-V? I tried using the clock() function 
from the C time library and I get results that roughly make sense but I'm not 
sure if this is accurate. For now I am only taking the number of CPU cycles 
reported in stats at face value, but it would be convenient to actually 
instrument the code.
Thanks in advance for your attention and responses! Below are more details if 
needed.
Basically, I'm trying to extend RV64 with some custom instructions and run 
certain benchmarks to see what performance improvement I can get compared to 
standard software libraries that provide the functions that these instructions 
will fulfill. One good example I'm particularly trying are SHA instructions 
(x86 provides an extension for these, for instance, but as far as I know RISC-V 
doesn't have a standard extension for them).
To keep things simpler, I wanted to use the MinorCPU model. Now, I was able to 
add custom instructions and run compiled code invoking those, but I have not 
specified any details regarding the execution of these custom instructions. As 
far as I know, gem5 only knows which 'class' of instructions they belong to, 
their opcodes and their functional description. Yet, when I look at the stats 
after running my code its clear that gem5 is making some assumptions as to how 
many clock cycles these instructions are taking. To get a better sense of this 
I included a new instruction that's basically a duplicate of an already 
existing one, and gem5 indeed reports the same timing information. This led me 
to think maybe this information was being derived from the class of 
instructions, but switching the instruction to a different one from the same 
class (I tested this with IntAlu operations) and keeping the code otherwise 
same led to different results. I'm doing very simple tests, just defining a fu
 nction using inline assembly and then operating on two integers with this 
function. So I am a bit confused as to how this timing information is set.
_______________________________________________
gem5-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to