代码之家  ›  专栏  ›  技术社区  ›  FabienM

用yosys实现verilog中case状态下的增量整数

  •  1
  • FabienM  · 技术社区  · 7 年前

    我不知道它是否在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\u阶跃数整数的增量不适用于格点综合程序(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(incrementinteger into case state)做这样的思考?

    1 回复  |  直到 7 年前
        1
  •  2
  •   dave_59    7 年前

    ++ 操作员在SystemVerilog中,而不是Verilog。 我认为合成工具需要case(表达式)或 item: 表达式可以是常量,但不允许两者都是非常量表达式。