【发布时间】:2020-12-10 18:09:53
【问题描述】:
我是 SystemVerilog 的新手,我想知道如何在 always_comb 块中处理对同一信号的多个分配。
我正在分析某人编写的 FSM,如果所有 if 语句都为真,我不明白哪个是下一个状态(名为“ctrl_fsm_ns”的信号)。在google上搜索,我发现这里使用了阻塞分配,所以我希望最后一个if语句将决定下一个状态(所以就像为每个if语句分配了一定的优先级)。但是,如果在每个 if 块中断言不同的信号怎么办?例如,即使下一个状态是最后一个状态,它们也会被断言?
这是一段我看不懂的代码。
always_comb
begin
...
unique case (ctrl_fsm_cs)
...
FIRST_FETCH:
begin
is_decoding_o = 1'b0;
// Stall because of IF miss
if ((id_ready_i == 1'b1) )
begin
ctrl_fsm_ns = DECODE;
end
// handle interrupts
if (irq_req_ctrl_i & irq_enable_int) begin
// This assumes that the pipeline is always flushed before
// going to sleep.
ctrl_fsm_ns = IRQ_TAKEN_IF;
halt_if_o = 1'b1;
halt_id_o = 1'b1;
end
if ((debug_req_pending || trigger_match_i) & (~debug_mode_q))
begin
ctrl_fsm_ns = DBG_TAKEN_IF;
halt_if_o = 1'b1;
halt_id_o = 1'b1;
end
end
【问题讨论】:
-
我没有运行模拟,我暂时没有模拟器。
标签: if-statement system-verilog fsm