我不知道它是否符合Verilog-2005标准,但是我设法用«synplify pro»和«icarus verilog»编译了以下代码。
integer fsm_step_number;
always @(posedge clk or posedge rst)
if(rst) begin
pc <= 8'h00;
wb_addr_o <= 8'h00;
wb_wdat_o <= 8'h00;
wb_stb_o <= 1'b0;
wb_cyc_o <= 1'b0;
wb_we_o <= 1'b0;
temt <= 1;
end
else begin
fsm_step_number=1;
case(pc)
fsm_step_number++: begin
wb_addr_o <= UART_LSR;
wb_stb_o <= 1'b1;
wb_cyc_o <= 1'b1;
wb_we_o <= 1'b0;
end
fsm_step_number++: begin
temt <= wb_rdat_i[6];
wb_stb_o <= 1'b0;
wb_cyc_o <= 1'b0;
wb_we_o <= 1'b0;
end
[...]
endcase
end
fsm_step_number整数的增量不适用于晶格合成程序(LSE),也不适用于Yosys。 我的yosys出现语法错误:
yosys> read_verilog uart_ctrl_pre.v
1. Executing Verilog-2005 frontend.
Parsing Verilog input from `uart_ctrl_pre.v' to AST representation.
ERROR: Parser error in line uart_ctrl_pre.v:74: syntax error, unexpected TOK_INCREMENT
您知道是否可以用Yosys(将整数递增为大小写状态)进行类似的思考?
答案 0 :(得分:2)
++
运算符位于SystemVerilog中,而不位于Verilog中。
而且我认为综合工具要求case(expression)或item:
表达式列表必须是常量,但不允许两者都是非常量表达式。