WIP
This commit is contained in:
parent
b82a6a9a79
commit
96b36317b3
@ -150,8 +150,8 @@ endinstance
|
||||
|
||||
interface MachineStatusIfc#(numeric type xlen);
|
||||
method Action beginTrap(RVPrivilegeLevel currentPriv);
|
||||
interface Get#(Bit#(xlen)) getMachineStatus;
|
||||
interface Put#(Bit#(xlen)) putMachineStatus;
|
||||
method Bit#(xlen) get;
|
||||
method Action put(Bit#(xlen) newMachineStatus);
|
||||
endinterface
|
||||
|
||||
module mkMachineStatus#(IsaCfg#(xlen) cfg)(MachineStatusIfc#(xlen))
|
||||
@ -172,14 +172,16 @@ module mkMachineStatus#(IsaCfg#(xlen) cfg)(MachineStatusIfc#(xlen))
|
||||
mstatus <= mstatus_pack(mstatus_);
|
||||
endmethod
|
||||
|
||||
interface Get getMachineStatus = toGet(mstatus);
|
||||
interface Put putMachineStatus;
|
||||
method Action put(Bit#(xlen) newValue);
|
||||
method Bit#(xlen) get;
|
||||
return mstatus;
|
||||
endmethod
|
||||
|
||||
method Action put(Bit#(xlen) newMachineStatus);
|
||||
//
|
||||
// Only MPP, MIE, and MIE are writable.
|
||||
//
|
||||
MachineStatus mstatus_ = mstatus_unpack(mstatus);
|
||||
MachineStatus value = mstatus_unpack(newValue);
|
||||
MachineStatus value = mstatus_unpack(newMachineStatus);
|
||||
|
||||
if (cfg.extS) begin
|
||||
mstatus_.mpp = value.mpp;
|
||||
@ -197,5 +199,4 @@ module mkMachineStatus#(IsaCfg#(xlen) cfg)(MachineStatusIfc#(xlen))
|
||||
|
||||
mstatus <= mstatus_pack(mstatus_);
|
||||
endmethod
|
||||
endinterface
|
||||
endmodule
|
||||
|
||||
@ -180,7 +180,7 @@ module mkCsrFile#(IsaCfg#(xlen) cfg)(CsrFileIfc#(xlen))
|
||||
csr_MIDELEG: result.value = mideleg;
|
||||
csr_MEDELEG: result.value = medeleg;
|
||||
|
||||
csr_MSTATUS: result.value <- mstatus.getMachineStatus.get;
|
||||
csr_MSTATUS: result.value = mstatus.get;
|
||||
|
||||
csr_MCYCLE, csr_CYCLE: begin
|
||||
result.value = mcycle;
|
||||
@ -226,7 +226,7 @@ module mkCsrFile#(IsaCfg#(xlen) cfg)(CsrFileIfc#(xlen))
|
||||
// No-Op
|
||||
end
|
||||
csr_MSCRATCH: mscratch <= value;
|
||||
csr_MSTATUS: mstatus.putMachineStatus.put(value);
|
||||
csr_MSTATUS: mstatus.put(value);
|
||||
csr_MTVAL: mtval <= value;
|
||||
csr_MTVEC: mtvec <= value;
|
||||
csr_MIE: mie <= value;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user