fmash16 / riscv_emulator

A basic working RISCV emulator written in C
GNU General Public License v3.0
56 stars 19 forks source link

Typo in "src/cpu.c" #3

Open Honneamise opened 1 year ago

Honneamise commented 1 year ago

in src/cpu.c ( lines 609-614 ) we have :

case ADDSUB:
                    switch (funct7) {
                        case ADD: exec_ADD(cpu, inst);
                        case SUB: exec_ADD(cpu, inst);
                        default: ;
                    } break;

i think line 612 : case SUB: exec_ADD(cpu, inst); should be instead : case SUB: exec_SUB(cpu, inst);

( https://github.com/fmash16/riscv_emulator/blob/main/src/cpu.c#L612 )

Thanks in advance.

crossrw commented 6 months ago

It seems to me that the “break” is still missing, after "exec_XXX();"

Honneamise commented 6 months ago

It seems to me that the “break” is still missing, after "exec_XXX();"

i understand what you mean, but in this situation it is not necessary.

in this sub-switch on "funct7" (int) if something weird happen, it will be catched in line 627 (the default case will print the error codes).

Cya