Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/dm_mem.sv
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,12 @@ module dm_mem #(
cmderror_valid_o = 1'b0;
cmderror_o = dm::CmdErrNone;
state_d = state_q;
go = 1'b0;
resume = 1'b0;
cmdbusy_o = 1'b1;

unique case (state_q)
Idle: begin
cmdbusy_o = 1'b0;
go = 1'b0;
resume = 1'b0;
if (cmd_valid_i && halted_q_aligned[hartsel] && !unsupported_command) begin
// give the go signal
state_d = Go;
Expand All @@ -164,6 +163,7 @@ module dm_mem #(
// we are already busy here since we scheduled the execution of a program
cmdbusy_o = 1'b1;
go = 1'b1;
resume = 1'b0;
// the thread is now executing the command, track its state
if (going) begin
state_d = CmdExecuting;
Expand All @@ -172,7 +172,8 @@ module dm_mem #(

Resume: begin
cmdbusy_o = 1'b1;
resume = 1'b1;
go = 1'b0;
resume = 1'b1;
if (resuming_q_aligned[hartsel]) begin
state_d = Idle;
end
Expand All @@ -181,13 +182,18 @@ module dm_mem #(
CmdExecuting: begin
cmdbusy_o = 1'b1;
go = 1'b0;
resume = 1'b0;
// wait until the hart has halted again
if (halted_aligned[hartsel]) begin
state_d = Idle;
end
end

default: ;
default: begin
cmdbusy_o = 1'b1;
go = 1'b0;
resume = 1'b0;
end
endcase

// only signal once that cmd is unsupported so that we can clear cmderr
Expand Down