1

Im not quite sure how to make a module which allows the output(B) of one module to become the input of another module(C).

2
  • It seems the OP already understands that modules have inputs and outputs. But not understanding how modules get instantiated and connections (the flow of assignments/drivers to sources) made is a very broad topic in SystemVerilog. Commented Nov 27, 2017 at 22:11
  • Duplicate of Output of a module used as input of another in verilog? Commented Nov 28, 2017 at 6:59

1 Answer 1

3

1) you need to declare your modules with input and output ports

 module A(input clk, input sig, output out);
          .. do somethign here
 endmodule

 module B(input clk, output val);
         ... do something to generate val.
 endmodule

2) you would need to create a hierarchy of instances, instantiating those modules, inside a top-level one. The latter will declare wires which should be used to connect these two:

module top(output topout);
  wire clk;
  wire sig;
  wire out;

  A a(clk, sig, topout);
  B b(clk, sig);
endmodule

So, in the above example output port val of instance b of module B is assigned to the wire sig of the top-level module. The same wire sig is connected to the input port sig of the instance a of the module A.

The output port out of the insance a is also connected to the output port topout port of the top-level module.

in both cases the clk wire is connected to two input ports: instance a and instance b.

This is the basic idea.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.