File tree Expand file tree Collapse file tree 1 file changed +18
-28
lines changed
Expand file tree Collapse file tree 1 file changed +18
-28
lines changed Original file line number Diff line number Diff line change @@ -132,33 +132,6 @@ module dm_mem #(
132132 typedef enum logic [1 : 0 ] { Idle, Go, Resume, CmdExecuting } state_e ;
133133 state_e state_d, state_q;
134134
135- // hart state decode
136- always_comb begin : p_state_decode
137- go = 1'b0 ;
138- resume = 1'b0 ;
139- cmdbusy_o = 1'b1 ;
140-
141- unique case (state_q)
142- Idle: begin
143- cmdbusy_o = 1'b0 ;
144- end
145- Go: begin
146- // we are already busy here since we scheduled the execution of a program
147- cmdbusy_o = 1'b1 ;
148- go = 1'b1 ;
149- end
150- Resume: begin
151- cmdbusy_o = 1'b1 ;
152- resume = 1'b1 ;
153- end
154- CmdExecuting: begin
155- cmdbusy_o = 1'b1 ;
156- go = 1'b0 ;
157- end
158- default : ;
159- endcase
160- end
161-
162135 // hart ctrl queue
163136 always_comb begin : p_hart_ctrl_queue
164137 cmderror_valid_o = 1'b0 ;
@@ -167,6 +140,9 @@ module dm_mem #(
167140
168141 unique case (state_q)
169142 Idle: begin
143+ cmdbusy_o = 1'b0 ;
144+ go = 1'b0 ;
145+ resume = 1'b0 ;
170146 if (cmd_valid_i && halted_q_aligned[hartsel] && ! unsupported_command) begin
171147 // give the go signal
172148 state_d = Go;
@@ -184,26 +160,40 @@ module dm_mem #(
184160 end
185161
186162 Go: begin
163+ // we are already busy here since we scheduled the execution of a program
164+ cmdbusy_o = 1'b1 ;
165+ go = 1'b1 ;
166+ resume = 1'b0 ;
187167 // the thread is now executing the command, track its state
188168 if (going) begin
189169 state_d = CmdExecuting;
190170 end
191171 end
192172
193173 Resume: begin
174+ cmdbusy_o = 1'b1 ;
175+ go = 1'b0 ;
176+ resume = 1'b1 ;
194177 if (resuming_q_aligned[hartsel]) begin
195178 state_d = Idle;
196179 end
197180 end
198181
199182 CmdExecuting: begin
183+ cmdbusy_o = 1'b1 ;
184+ go = 1'b0 ;
185+ resume = 1'b0 ;
200186 // wait until the hart has halted again
201187 if (halted_aligned[hartsel]) begin
202188 state_d = Idle;
203189 end
204190 end
205191
206- default : ;
192+ default : begin
193+ cmdbusy_o = 1'b1 ;
194+ go = 1'b0 ;
195+ resume = 1'b0 ;
196+ end
207197 endcase
208198
209199 // only signal once that cmd is unsupported so that we can clear cmderr
You can’t perform that action at this time.
0 commit comments