Projects icon indicating copy to clipboard operation
Projects copied to clipboard

Bug in RISCV_C_Version?

Open michaelengel opened this issue 5 years ago • 2 comments

The comparison operator for "BLTU" in riscv.c (l. 91) should be "<" instead of ">=" (this line is identical to the "BGE" line below it except for the instruction name):

if (opcode==0b1100011 && funct3==0b110) { if (rv5_reg[rs1]**>=**rv5_reg[rs2]) rv5_pc = ( (B_immediate_SE) + rv5_pc) - 0x4; printf(" BLTU "); } else // BLTU

michaelengel avatar Apr 03 '20 20:04 michaelengel

Fixed!

Thanks, -Ted


From: Michael Engel [email protected] Sent: Friday, April 3, 2020 1:31 PM To: MicroCoreLabs/Projects [email protected] Cc: Subscribed [email protected] Subject: [MicroCoreLabs/Projects] Bug in RISCV_C_Version? (#4)

The comparison operator for "BLTU" in riscv.c (l. 91) should be "<" instead of ">=" (this line is identical to the "BGE" line below it except for the instruction name):

if (opcode==0b1100011 && funct3==0b110) { if (rv5_reg[rs1]**>=**rv5_reg[rs2]) rv5_pc = ( (B_immediate_SE) + rv5_pc) - 0x4; printf(" BLTU "); } else // BLTU

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/MicroCoreLabs/Projects/issues/4, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AM4AVEP4WO5ODXIB3TLU7FTRKZBSDANCNFSM4L4NRKQQ.

MicroCoreLabs avatar Apr 03 '20 21:04 MicroCoreLabs

Sure, you're welcome! Very nice compact code - I wrote a RISC V emulator for my students in Go, this took quite a number of lines more...

Oh, and thanks for open sourcing your CPU cores, very much appreciated!

Best, Michael

On 3 Apr 2020, at 23:40, MicroCoreLabs [email protected] wrote:

Fixed!

Thanks, -Ted


From: Michael Engel [email protected] Sent: Friday, April 3, 2020 1:31 PM To: MicroCoreLabs/Projects [email protected] Cc: Subscribed [email protected] Subject: [MicroCoreLabs/Projects] Bug in RISCV_C_Version? (#4)

The comparison operator for "BLTU" in riscv.c (l. 91) should be "<" instead of ">=" (this line is identical to the "BGE" line below it except for the instruction name):

if (opcode==0b1100011 && funct3==0b110) { if (rv5_reg[rs1]**>=**rv5_reg[rs2]) rv5_pc = ( (B_immediate_SE) + rv5_pc) - 0x4; printf(" BLTU "); } else // BLTU

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/MicroCoreLabs/Projects/issues/4, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AM4AVEP4WO5ODXIB3TLU7FTRKZBSDANCNFSM4L4NRKQQ. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

michaelengel avatar Apr 03 '20 21:04 michaelengel