0

How do I access internal regs/signals without declaring them as input/output. e.g., consider the following block, A & B are placed in TOP block and I need to access int_A from withing block B without declaring it as output in A and input in B.

enter image description here

2
  • To the best of my knowledge there is no way (and I would be actually shocked if there is one, as it would mean that "sideeffects" could be implemented which implies serious testablity issues). Could you elaborate why "exposing" int_T is not an option for you? Commented May 15, 2019 at 10:22
  • Well, I am creating a block which has both digital and analog blocks. in order to model the analog block i need to create element which do not really exist in the analog. e.g. say the analog block has an output voltage output. This output it a 'single bit' from the analog part. However inside the analog block MODEL I use a 'real' or bus to represent the voltage. i do not want to add extra outputs to the analog block, in this case the representation of the voltage. Commented May 15, 2019 at 10:52

1 Answer 1

3

You can do that by hierarchical reference.
However as far as I know you can only use that in test-benches.(I have never even dared to use that in RTL).

// Top level test-bench

wire int_A;
   assign int_A = dut_0.int_A;

dut dut_0 ( // instance of dut
       .... 
       );

If inside the dut you have another instance use the same method:

module dut (
   );

  core core0 (
       ); 
endmodule // dut

A signal inside the core can now be referenced from the top level as:

assign int_A = dut_0.core_0.int_A;

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

2 Comments

so the way to do this, in my case, since A & B are under the TOP, is to use 2 statements? 1 in the top to reference the wire in Block A, and 1 in block B to reference the wire (reference) in A? Is there a way to use only 1 definition, inside block B which references a wire in A? Both A & B are under TOP.
I think you can do a full path reference form anywhere in the design. Thus in B you can use top.A.int_A.

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.