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.

elegant way to write vector into vector

Status
Not open for further replies.

modsRule

Newbie level 3
Joined
Sep 3, 2010
Messages
3
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,297
I am looking for a nice way to write a short std_logic_vector to a specific location in a larger std_logic_vector using VHDL.

For example:
Code:
--If I define a port CTRL such that
CTRL : out STD_LOGIC_VECTOR (15 downto 0);

--And a signal posmul0
signal posmul0 : STD_LOGIC_VECTOR (2 downto 0);

--And want to then write posmul0 into CTRL in locations [3:1], whilst setting CTRL[0] to '1'
--I could do it like this:
CTRL(0) <= '1';
CTRL(1) <= posmul0(0);
CTRL(2) <= posmul0(1);
CTRL(3) <= posmul0(2);

But there must be a neater way, especially if the vectors were larger than in this example.
 

x(a downto b) <= y(a-1 downto b) & '1';

for-loop and for-generate can also be useful.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top