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.

How to bundle signals in VHDL

Status
Not open for further replies.

childs

Member level 5
Joined
Apr 28, 2008
Messages
87
Helped
15
Reputation
30
Reaction score
12
Trophy points
1,288
Activity points
1,945
Hi, I am working on VHDL code where I wish to bundle certain parts of a std_logic_vector signals for readability purpose. A simplified demonstration of my design is as follow:
Code:
signal data: std_logic_vector(15 downto 0);   --data(15 downto 8) is data_part_1; data(7 downto 0) is data_part_2
......
instead of:
Code:
if (data(15 downto 8) = x"ff) then
...... (work on part 1)
if (data(7 downto 0) = x"55") then
...... (work on part 2)
I wish to make my code more readable by:
Code:
if (data_part_1 = x"ff") then
...... (work on part 1)
if (data_part_2 = x"55") then
...... (work on part 2)
Assigning data into signals data_part_1 & data_part_2 will need another clock cycle. My current implementation is assign using variables as below, may I know such whether this is appropriate for design to be synthesized? Is there a better or more appropriate way to do this?
Code:
data_part_1 := data(15 downto 8);
data_part_2 := data(7 downto 0);

Thanks!
 

Hi, I am working on VHDL code where I wish to bundle certain parts of a std_logic_vector signals for readability purpose. A simplified demonstration of my design is as follow:
Code:
signal data: std_logic_vector(15 downto 0);   --data(15 downto 8) is data_part_1; data(7 downto 0) is data_part_2
......
instead of:
Code:
if (data(15 downto 8) = x"ff) then
...... (work on part 1)
if (data(7 downto 0) = x"55") then
...... (work on part 2)
I wish to make my code more readable by:
Code:
if (data_part_1 = x"ff") then
...... (work on part 1)
if (data_part_2 = x"55") then
...... (work on part 2)
Assigning data into signals data_part_1 & data_part_2 will need another clock cycle. My current implementation is assign using variables as below, may I know such whether this is appropriate for design to be synthesized? Is there a better or more appropriate way to do this?
Code:
data_part_1 := data(15 downto 8);
data_part_2 := data(7 downto 0);

Thanks!

use alias

example

alias data_part1:std_logic_vector(7 downto 0 ) is data(15 downto 8)

then you can
if (data_part1=x"FF" ) then

---------- Post added at 16:24 ---------- Previous post was at 16:15 ----------

An Alias provides an alternative name for all or part of named item .


1.h**p://www.people.vcu.edu/~rhklenke/tutorials/vhdl/modules/m13_23/sld009.htm

2.h**p://www.ics.uci.edu/~jmoorkan/vhdlref/aliasdec.html
 
Last edited:
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top