How to write an "alias" statement

Dec 04, 2018 4 Replies

Hi,



I have a register array with each register having (pointer & data), now I hope to display each of two parts using 2 different names for easy reading in simulation.



Here is code defining the register array R: type R_Type is array(0 to R_SIZE) of unsigned(POINTER_BITS + DATA_BITS-1 downto 0); signal R : R_Type; alias P1 : it shows R array part of (DATA_BITS-1 downto 0); alias P2 : it shows R array part of (POINTER_BITS-1 downto DATA_BITS);



How to write the 2 alias statements in VHDL 2002 or 2008?



Thank you.



Weng


Here is my version for the answer: type P1_Type array(0 to R_SIZE) of unsigned(DATA_BITS-1 downto 0);

alias P1 : P1_Type := R(0 to R_SIZE) of unsigned(DATA_BITS-1 downto 0);

It should work on both 2002/2008 VHDL.

Thank you.

Weng

"Should" work??? Haven't you tested it?

Rick C.

Tesla referral code -

formatting link

Hi Rick,

You have been the most famous contributor in FPGA and VHDL group for more than 10 years. If you answer, there is a problem.

Here is a correction version:

type P1_Type array(0 to R_SIZE) of unsigned(DATA_BITS-1 downto 0);

alias P1 : P1_Type := R(0 to R_SIZE)(DATA_BITS-1 downto 0);

Currently I have no Modelsim working and have no means to test. If you are kind enough, please test it. I think it SHOULD work.

Thank you.

Weng

:

te:

now I hope to display each of two parts using 2 different names for easy r eading in simulation.

ITS-1 downto 0);

TS);

o 0);

than 10 years. If you answer, there is a problem.

First, don't assume that a "frequent" contributor means someone who knows a nything. Then notice I only asked a question. I didn't say there was anyt hing wrong.

e kind enough, please test it. I think it SHOULD work.

You can download a copy of nearly any FPGA vendor's tools and use whichever simulator they include. I would run it for you, but I am pretty busy at t he moment. I'm with a friend who has gone through surgery and I have busin ess tasks to deal with. Sorry I can't help more.

Rick C.

Tesla referral code +

formatting link

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required