A Question About Concatenation in VHDL

Joined
Nov 22, 2011
Messages
2
Reaction score
0
Hello Everyone, I'm very new to VHDL and to this forum so If my question doesn't belong here or already answered I apologize, here's my question, when we concatenate bits to a vector will it be any faster than a for loop to do it?
Here's an example, imagine we have a sign extension in our system(let say 4 bit to 8 bit)
which of the following code would be faster and safer to use?

Code:
bit8(3 downto 0)<=bit4(3 downto 0);

bit8(7 downto 4)<=bit4(3)&bit4(3)&bit4(3)&bit4(3);
OR,

Code:
bit8(3 downto 0)<=bit4(3 downto 0);

for i in 7 downto 4 loop
	bit8(i)<=bit4(3);
end loop;
Thank you for your help,
 
Joined
Mar 10, 2008
Messages
348
Reaction score
0
Hi

Please remember - VHDL a Hardware Description Language.

Hence will the result of your code (if not it's for simulation) be a circuit of logic devices
(Properly inside a FPGA)

If both your solutions gives the wanted hardware and functionality (and I beleive it does)
then you shouldn't care.

But I agree that your computer could use, say 0.00001 seconds Synthesizing the code.

Your welcome
 
Joined
Nov 22, 2011
Messages
2
Reaction score
0
Hi Jeppe,
Thank you for your answer, I think I should stop treating vhdl as a High level programming language...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top