EmbDev.net

Forum: FPGA, VHDL & Verilog concatenate operation with generic value


Author: sreeram sam (sresam89)
Posted on:

Rate this post
0 useful
not useful
dear all,
i want to concatenate a register(of dynamic size as for concatenation) 
with n no:of zeros where n is a  generic integer number.please help!!!
Thanks in advance....

Author: sreeram sam (sresam89)
Posted on:

Rate this post
0 useful
not useful
dear all,
i want to concatenate a register(of dynamic size as for concatenation) 
with n no:of zeros where n is a  generic integer number.

say for eg
num1_reg := "00" & num1;--here only two zeros are only used

i would like to make it something that would work like this

 num1_reg := "N zeros" & num1;--wherein n is a generic number

how to make it work..please advice...
thanks in advance

Author: Thomas Reinemann (Company: abaxor engineering) (abaxor)
Posted on:

Rate this post
0 useful
not useful
sreeram sam wrote:
>  num1_reg := "N zeros" & num1;--wherein n is a generic number

num1_reg := (n-1 downto 0 => '0')  & num1;

But you don't need a generic

num1_reg := (num1_reg'high downto num1'length => '0') & num1;

does the same.

Tom

Author: sreeram sam (sresam89)
Posted on:

Rate this post
0 useful
not useful
Thomas Reinemann wrote in post >
> num1_reg := (num1_reg'high downto num1'length => '0') & num1;
>
> does the same.

i don know what this statement does!!

num1_reg'high downto num1'length => '0' ??

num1_reg'high ??

num1_reg'length ??

Author: bko (Guest)
Posted on:

Rate this post
0 useful
not useful

Author: sreeram sam (sresam89)
Posted on:

Rate this post
0 useful
not useful
thanks bko, got sorted it out...

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.