I am having trouble in building a chain of modules. I can connect models manually listing all the modules but need more concise representation. The following code has been tried but doesn’t work? How can I correct the codes?
module network(
input signed [31:0] xi,
output signed [31:0] yo,
input clk,
input reset
);
wire signed [31:0] x0, x1, x2, y0, y1, y2, xo;
wire [3:1] t;
//working code for chain of pe
// pe u0(xi, x0, 0, y0, clk, reset);
// pe u1(x0, x1, y0, y1, clk, reset);
// pe u2(x1, x2, y1, y2, clk, reset);
// pe u3(x2, xo, y2, yo, clk, reset);
//chain of array not working! how!
pe p[1:4] ((xi,t), (t, x), (0, t), (t,yo),clk,reset); <- want to improve
endmodule
Here, pe (input,output,input,output,clk,reset).
Try this. It should work in all version of Verilog. In this instance the parameter PE_NUM must be an int with a value of 2 or more. A generate block must be use if a 1 pe instance is desired, which requires Verilog-2001 or SystemVerilog. Some simulators may have an hit a memory limitation when PE_NUM gets big (ex 2**16).
The following is an example with generate: