I have some modules in my scheme and I want to connect it by massive of wires. How it look in my mind:
When come changes of variable some_trigger in top level module, in this moment top level module send signal by input_output_wire in module a1-> module a1 make some stuff -> module a1 send too module a2 by the massive_input_output_wire[0] -> module a2 make some stuff -> a2 send by next wire in the massive massive_input_output_wire[1] to module a3 -> a3 make some stuff -> send to a4 by massive_input_output_wire[2] and so on...
module a(
input_output_wire;
);
input input_output_wire;
output input_output_wire;
always @(posedge input_output_wire)
begin
if(input_output_wire) begin
....
make some stuff
....
end
end
end module
`include "a.v"
module top_level(
clk,
rst,
some_trigger
);
input clk, rst, some_trigger;
parameter NUM_OF_MODULES_A = 5;
wire massive_input_output_wire[0:NUM_OF_MODULES_A];
a a1(.input_output_wire(massive_input_output_wire[0]));
a an(.input_output_wire(massive_input_output_wire[NUM_OF_MODULES_A-1]));
genvar i;
genarate
for(i=1;i<NUM_OF_MODULES_A-2; i = i + 1)
begin : modules_a
a modules_a(
.(input_output_wire(massive_input_output_wire[i]))
);
end
endgenerate
always @(posedge some_trigger)
begin
if(some_trigger)
massive_input_output_wire[0] = 1;
end
endmodule
assignorforcestatements to assign a wire within an always block (I'm guessing that is what you are currently doing). - Grega1,a2,....an) in this logic : output wire froma1(massive_input_output_wire[0]) must go to input ofa2. Output wire from a2(massive_input_output_wire[1]) must go to input of a3 .. output wire froma[n-1](massive_input_output_wire[n]) must go to inputa[n]. The question is how correctly write the code for generate modules (modules_a) and for modules that I wrote without generatea1andan- Antonashould have at least two ports: an input and an output.a inst_a( .output_wire(massive_input_output_wire[i]), .input_wire(massive_input_output_wire[i-1]) );- Greg