gem5-users@gem5.org

The gem5 Users mailing list

View all threads

Microcode_ROM Instruction and fetchRomMicroop() Function

AS
Abdelrahman S. Hussein
Wed, Jan 17, 2024 11:22 PM

Hello,

I am looking at the AtomicSimpleCPU code in src/cpu/simple for x86 ISA. I
am trying to understand the following code snippet. Whenever this condition
is true for a given PC, it does NOT follow the regular fetch from the
instruction cache and then decode. This results in a macroop called
Microcode_ROM, which is not an x86 macroop that has a sequence of uops
(can be seen in the O3 CPU). Example: Instruction is:  Microcode_ROM :
ldst  t0, HS:[t0 + t6 + 0x20] (This is taken from the O3 logs running the
same workload by checking the same PC in the Debug logs).

I am not sure what this macroop is and what the benefit is from the code
below. Does this mean this instruction has no x86 machine instruction
binary? If it has an x86 instruction binary, how to get it?

if (isRomMicroPC(pc_state.microPC())) {

    t_info.stayAtPC = false;

    curStaticInst = decoder->fetchRomMicroop(

            pc_state.microPC(), curMacroStaticInst);

}

Thanks,

--

Best,Abdelrahman Hussein

Hello, I am looking at the AtomicSimpleCPU code in src/cpu/simple for x86 ISA. I am trying to understand the following code snippet. Whenever this condition is true for a given PC, it does NOT follow the regular fetch from the instruction cache and then decode. This results in a macroop called `Microcode_ROM`, which is not an x86 macroop that has a sequence of uops (can be seen in the O3 CPU). Example: Instruction is: Microcode_ROM : ldst t0, HS:[t0 + t6 + 0x20] (This is taken from the O3 logs running the same workload by checking the same PC in the Debug logs). I am not sure what this macroop is and what the benefit is from the code below. Does this mean this instruction has no x86 machine instruction binary? If it has an x86 instruction binary, how to get it? if (isRomMicroPC(pc_state.microPC())) { t_info.stayAtPC = false; curStaticInst = decoder->fetchRomMicroop( pc_state.microPC(), curMacroStaticInst); } Thanks, -- *Best,Abdelrahman Hussein*
YY
Yuan Yao
Thu, Jan 18, 2024 9:06 AM

Hi,

The ROM contains predefined micro-code routines for purposes such as apic interrupt handler (arch/x86/isa/insts/romutil.py).

If you are simulating a full system then basically the interrupt is triggered by 8254 timer (dev/x86/i8254.py) and when it is triggered the core fetches instructions from the ROM to handle interrupts.

For example, for the timer interrupt the linux updates process cgroup times for, do soft irqs, and reschedule, etc.

Hope this helps.

Br,

Yuan.

On 1/18/24 00:22, Abdelrahman S. Hussein via gem5-users wrote:
Hello,

I am looking at the AtomicSimpleCPU code in src/cpu/simple for x86 ISA. I am trying to understand the following code snippet. Whenever this condition is true for a given PC, it does NOT follow the regular fetch from the instruction cache and then decode. This results in a macroop called Microcode_ROM, which is not an x86 macroop that has a sequence of uops (can be seen in the O3 CPU). Example: Instruction is:  Microcode_ROM : ldst  t0, HS:[t0 + t6 + 0x20] (This is taken from the O3 logs running the same workload by checking the same PC in the Debug logs).

I am not sure what this macroop is and what the benefit is from the code below. Does this mean this instruction has no x86 machine instruction binary? If it has an x86 instruction binary, how to get it?

if (isRomMicroPC(pc_state.microPC())) {

    t_info.stayAtPC = false;

    curStaticInst = decoder->fetchRomMicroop(

            pc_state.microPC(), curMacroStaticInst);

}

Thanks,

--
Best,
Abdelrahman Hussein

När du har kontakt med oss på Uppsala universitet med e-post så innebär det att vi behandlar dina personuppgifter. För att läsa mer om hur vi gör det kan du läsa här: http://www.uu.se/om-uu/dataskydd-personuppgifter/

E-mailing Uppsala University means that we will process your personal data. For more information on how this is performed, please read here: http://www.uu.se/en/about-uu/data-protection-policy

Hi, The ROM contains predefined micro-code routines for purposes such as apic interrupt handler (arch/x86/isa/insts/romutil.py). If you are simulating a full system then basically the interrupt is triggered by 8254 timer (dev/x86/i8254.py) and when it is triggered the core fetches instructions from the ROM to handle interrupts. For example, for the timer interrupt the linux updates process cgroup times for, do soft irqs, and reschedule, etc. Hope this helps. Br, Yuan. On 1/18/24 00:22, Abdelrahman S. Hussein via gem5-users wrote: Hello, I am looking at the AtomicSimpleCPU code in src/cpu/simple for x86 ISA. I am trying to understand the following code snippet. Whenever this condition is true for a given PC, it does NOT follow the regular fetch from the instruction cache and then decode. This results in a macroop called `Microcode_ROM`, which is not an x86 macroop that has a sequence of uops (can be seen in the O3 CPU). Example: Instruction is: Microcode_ROM : ldst t0, HS:[t0 + t6 + 0x20] (This is taken from the O3 logs running the same workload by checking the same PC in the Debug logs). I am not sure what this macroop is and what the benefit is from the code below. Does this mean this instruction has no x86 machine instruction binary? If it has an x86 instruction binary, how to get it? if (isRomMicroPC(pc_state.microPC())) { t_info.stayAtPC = false; curStaticInst = decoder->fetchRomMicroop( pc_state.microPC(), curMacroStaticInst); } Thanks, -- Best, Abdelrahman Hussein När du har kontakt med oss på Uppsala universitet med e-post så innebär det att vi behandlar dina personuppgifter. För att läsa mer om hur vi gör det kan du läsa här: http://www.uu.se/om-uu/dataskydd-personuppgifter/ E-mailing Uppsala University means that we will process your personal data. For more information on how this is performed, please read here: http://www.uu.se/en/about-uu/data-protection-policy