Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Array or Logic Vector?

Status
Not open for further replies.

BlackOps

Full Member level 5
Joined
Jan 1, 2005
Messages
279
Helped
14
Reputation
28
Reaction score
3
Trophy points
1,298
Location
AZERBAIJAN
Activity points
2,496
Hello,

For example i want to declare a Red signal.. which is one of the RGB signals. Red signal will have 8 bits.. inside the code, i will assign different bits of this Red signal to the different signals... how is it better to declare the Red?

like this:

Red: IN STD_LOGIC_VECTOR (7 DOWNTO 0);
do i refer to different bits of this Red signal like.. Red(0) or Red[0] ???

or this:

TYPE Red IS ARRAY (7 DOWNTO 0) OF BIT;
do i refer to different bits of this Red signal like.. Red(0) or Red[0] ???
 

I think the former method is better and u can access individual bits using RED(7),RED(6),....RED(0).

Though the latter is also correct, u will have to include another line...

TYPE Red IS ARRAY (7 DOWNTO 0) OF BIT ; -- this will just create a datatype

SIGNAL RED_signal : Red ; -- this will create ur actual signal


PS : array elements too are accessed by '()' ie round parenthesis. No square brackets.
 

    BlackOps

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top