【问题标题】:Increment integer under case state in verilog with yosys使用yosys在verilog中的case状态下增加整数
【发布时间】:2018-08-30 16:01:20
【问题描述】:

我不知道它是否符合 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 做这样的思考(将整数递增到 case 状态)?

【问题讨论】:

    标签: verilog yosys


    【解决方案1】:

    ++ 运算符在 SystemVerilog 中,而不是在 Verilog 中。 而且我认为综合工具要求 case(expression) 或 item: 表达式列表是常量,但不允许两者都是非常量表达式。

    【讨论】:

      猜你喜欢
      • 2019-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-27
      • 2019-02-12
      • 1970-01-01
      相关资源
      最近更新 更多