2016-02-25 49 views
0
module CSHM #(parameter data_width=8,order=4) 
(y,in,clk,reset_n); 

wire [data_width-1:0]coeff[0:order-1]; 
output reg signed [2*data_width-1:0]y; 

input clk,reset_n; 
input signed[data_width-1:0]in; 
integer i; 
wire [15:0] product1,product2,product3,product4,product5,product6,product7,product8; 
wire signed[3:0]lsboutputcoeff; 
wire signed[7:4]msboutputcoeff; 
wire signed[2:0]lsbcount,msbcount; 
wire signed[2:0]lsbselect,msbselect; 

wire signed[2*data_width-1:0]muxoutput,shiftoutlsb,shiftoutmsb; 
    wire [3:0] lsbcoeff; 
    wire [7:4] msbcoeff; 
    //reg [7:0] this_coeff; 

wire [2:0]inputshift; 
wire signed[15:0]muxout; 
wire signed[15:0]leftshiftone,leftshifttwo,leftshiftthree; 
wire [15:0]outputshift; 




bankofprecomputers b1(.product1(product1),.product2(product2),.product3(product3),.product4(product4),.product5(product5),.product6(product6),.product7(product7),.product8(product8),.in(in)); 

genvar count; 
generate   
assign coeff[0]= 8'd1; 
assign coeff[1]= 8'd2; 
assign coeff[2]= 8'd3; 
assign coeff[3]= 8'd4; 
for(count = 0; count < order ; count = count+1) 
begin : gen_loop 
    assign lsbcoeff = coeff[count][3:0]; 
     assign msbcoeff = coeff[count][7:4]; 



shifter s1(.lsboutputcoeff(lsboutputcoeff),.msboutputcoeff(msboutputcoeff),.lsbselect(lsbselect),.msbselect(msbselect),.lsbcount(lsbcount),.msbcount(msbcount),.lsbcoeff(lsbcoeff),.msbcoeff(msbcoeff)); 
    end 
endgenerate 
mux8_1msb m1(.muxoutput(muxoutput),.msbselect(msbselect),.product1(product1),.product2(product2),.product3(product3),.product4(product4),.product5(product5),.product6(product6),.product7(product7),.product8(product8)); 

mux8_1LSB m2(.muxoutput(muxoutput),.lsbselect(lsbselect),.product1(product1),.product2(product2),.product3(product3),.product4(product4),.product5(product5),.product6(product6),.product7(product7),.product8(product8));    

inverse_shifter is1(.shiftoutmsb(shiftoutmsb),.muxoutput(muxoutput),.msbcount(msbcount)); 

inverse_shifter_LSB is2 (.shiftoutlsb(shiftoutlsb),.muxoutput(muxoutput),.lsbcount(lsbcount)); 



     [email protected](negedge clk) 
     begin 
     y = shiftoutmsb+shiftoutlsb; 
      end 



endmodule 

当即时试图合成,即时得到误差作为错误的Verilog,使用生成语句CSHM筛选编码

多源在上信号lsbcoeff3股;这个信号是 连接到多个驱动程序。

多信号源单元信号lsbcoeff0;这个信号是 连接到多个驱动程序。

如果我错在任何地方,请指导我

回答

1

lsbcoeffmsbcoeff跨过静态展开产生循环共享,因此你有平行分配到这些网。为了解决这个问题,你需要使网络在每个循环中都是唯一的。这可以通过两种不同的方式完成。

  1. 阵列篮网:

    wire signed [2:0] lsbcount [0:order-1]; 
    wire signed [2:0] msbcount [0:order-1] 
    for(count = 0; count < order ; count = count+1) begin : gen_loop 
        assign lsbcoeff[count] = coeff[count][3:0]; 
        assign msbcoeff[count] = coeff[count][7:4]; 
        ... 
    
  2. 通过宣布他们产生循环内部本地化网:注:这种形式给出,篮网不会被外界的循环范围的访问。

    for(count = 0; count < order ; count = count+1) begin : gen_loop 
        wire signed [2:0] lsbcoeff = coeff[count][3:0]; 
        wire signed [2:0] msbcoeff = coeff[count][7:4]; 
        ... 
    end 
    // lsbcoeff and msbcoeff cannot be accessed outside of the loop 
    
+0

即时得到相同的错误... :( –

+0

@SugureshKumarArali,更新问题中的代码我怀疑你得到了完全相同的错误信息,如果你做了正确的更改,我看到相同的多驱动程序问题'lsboutputcoeff'和'msboutputcoeff'。提醒一下,生成块中的循环并行运行,不是程序性的。 – Greg

+0

好吧,但我有4个系数,必须分成LSB和MSB系数,必须更新请引导我,它是一个CSHM过滤器体系结构 –

0

环或多或少像同一行重复n次。

for(count = 0; count < order ; count = count+1) 
begin : gen_loop 
    assign lsbcoeff = coeff[count][3:0]; 
     assign msbcoeff = coeff[count][7:4]; 
.... 

So @Suguresh,你的原代码有问题。

正如格雷格正确指出,你需要纠正这一点。对于您的代码,解决方案1看起来更合适。你可以更改代码并发布更新以重新检查吗? (