microsoft / cheriot-ibex

cheriot-ibex is a RTL implementation of CHERIoT ISA based on LowRISC's Ibex core.
Apache License 2.0
73 stars 14 forks source link

Destination register not taken into account for detection of illegal load instruction #42

Open esdatmisarian opened 1 month ago

esdatmisarian commented 1 month ago

Observed Behavior

In ibex_decoder, rf_we is not assigned in opcode case block

"unique case (opcode) ... OPCODE_LOAD: begin rf_ren_a_o = 1'b1; data_req_o = 1'b1; data_type_o = 2'b00; .. " For configuration RV32E, illegal destination not detetcted as in example for instruction lh x20, 1956(x4) See snap issue_on_destination_register_decoding_for_load_cheri

Expected Behavior

Steps to reproduce the issue

My Environment

EDA tool and version:

Operating system:

Version of the Ibex source code:

https://github.com/microsoft/cheriot-ibex/commit/d3672fe5b6b656545fd6f0d5100d0e1b97743ee0

kliuMsft commented 1 month ago

Thanks. This is indeed a corner case that I have overlooked. In the ibex decoder implementation rf_we is not set for load instructions since in that case the actual regfile writes are generated by LSU responses. So we should include that in the condition for illegal register detection. I will fix this in the next commit.

kliuMsft commented 1 month ago

Commit 3f0ec86 should fix the issue, please confirm. Thanks,