简体   繁体   English

Verilog中的计算逻辑生成块

[英]Compute logic in verilog generate block

am trying to instantiate a simple module in a generate block with different hierarchical clocks. 我试图在具有不同分层时钟的generate块中实例化一个简单模块。 But facing this issue: 但是面对这个问题:

Error-[SE] Syntax error Following verilog source has syntax error : "testbench/tb/uflex_ilk_comp_ext_s10_top_cr3.sv", 242: token is '=' 错误-[SE]语法错误以下verilog源具有语法错误:“ testbench / tb / uflex_ilk_comp_ext_s10_top_cr3.sv”,242:令牌为'='
genvar j=i/4; genvar j = i / 4; ^ ^

`define CLK uflex_ilk_comp_ext_s10_top.dut.soft_pcs_pam4.pam4_phy_inst[j].pam4_phy.nphy.g_xcvr_native_insts[k].ct3_xcvr_native_inst.inst_ct3_xcvr_channel.inst_ct3_hssi_xcvr.ct3_hssi_xcvr_encrypted_inst.ct1_hssirtl_c3xcvr_inst.u_serdes.corif_serial_clk_tx


genvar i;
generate
  for (i=0; i<NUM_LANES; i++) begin:delay_bmod_inst
genvar j=i/4;  --> Using j and k in CLK define
genvar k=i%4;
    txrx_delay_bmod #(.LANE_NUM(i), .MAX_LANE_DELAY(107), .GROUP_DELAY_RANGE(17)) txrx_delay_bmod_1 (
        .clk(`CLK),
        .i_tx_data(tx_serial_data[i]),
        .o_tx_data(tx_serial_data_dly[i])
    );
  end
endgenerate

You are not allowed to assign to a genvar . 您不允许分配给genvar This is illegal: 这是非法的:

genvar j=i/4;

Hence your error message. 因此,您的错误消息。

If you are using SystemVerilog, you can write as 如果您正在使用SystemVerilog,则可以编写为

for (genvar i=0; i<NUM_LANES; i++) begin:delay_bmod_inst
  localparam j=i/4;  //--> Using j and k in CLK define
  localparam k=i%4;
  txrx_delay_bmod #(.LANE_NUM(i), .MAX_LANE_DELAY(107), .GROUP_DELAY_RANGE(17)) 
         txrx_delay_bmod_1 (
        .clk(`CLK),
        .i_tx_data(tx_serial_data[i]),
        .o_tx_data(tx_serial_data_dly[i])
    );
  end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM