Closed wysiwyng closed 1 year ago
I don't think 4. would work well in CoreDSL, because then the current ISS-driven behavior for PC updates would resemble non-blocking assignments (<=
) in Verilog, whereas the rest of the language uses C-style, blocking assignments. Through this C-lens, I would expect X[rd] == address-of(ins1) + imm
(in case X[rs1] == X[rs2]
).
Option 1. or 3. (or a mix thereof) sound promising to me. I'd let the compiler detect CF paths on which the register with the [[is_pc]]
attribute is not written.
For completeness:
I would opt for 4 since the PC is by adding the [[is_pc]]
attribute a special veriable, in my understanding it makes it a deferred-update variable. This means if I read the PC I always read the actual value not the written value being scheduled to be updated.
For me as a user of CoreDSL it feels natural to write PC=PC+X[rs1]
and this is also inline with e.g. instruction descriptions (not only for RISC-V)
I think this should be decided for 2.0 -- ISS people (@eyck @wysiwyng), are you happy with handling the implicit PC increment via an always
block (somewhere high up in the hierarchy)? If so, we could just close this issue.
always { implicit_increment { PC += sizeof(encoding); } }
Yes, let's do it this way.
Currently, the PC increment is not defined; implementers have to assume that it will be ~automagically~ performed correctly. From what I see, the current intended behavior (and what ETISS as well as DBT-RISE implement) is roughly this:
nextPC = PC + sizeof(encoding)
before actual instruction behavior is executednextPC = PC + sizeof(encoding)
before actual behavior, instruction body can then conditionally overwrite the default behaviorThis behavior must be documented somewhere. It is however problematic with regard to repeated accesses to the PC register:
With the behavior explained above, the repeated PC reads in this example would not yield the expected results. I propose the following mechanisms to avoid these issues:
More suggestions on how to solve this issue are very welcome, especially regarding normal usage of the PC register in CoreDSL code.