- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am using the following code in my design (c_repack_reg_size and c_k_eff are constant integers), trying to shift left by an unkonwn integer: signal repack_reg : std_logic_vector (c_repack_reg_size - 1 downto 0); signal repack_reg_ind : integer range (c_repack_reg_size - 1) downto 0; repack_reg(c_repack_reg_size - 1 downto c_k_eff + repack_reg_ind + 1) <= repack_reg( c_repack_reg_size - 1 - c_k_eff downto repack_reg_ind + 1); quartus gives me an error saying that the right bound of repack_reg must be constant. what is the correct and most efficient way to perform the wanted shift? Thanks, OmerLink Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
are you deliberatly trying to leave the LSBs of repack_reg alone? because thats what this code is trying to do. Usually you would assign the entire repack_reg.
a variable shift is just a *2^n, which is fairly straight forward. try this: edit - forgot about sizing
variable temp_var : unsigned(repack_reg'high*2 -1 downto 0);
temp_var := unsigned(repack_reg) * (2**repack_reg_ind);
repack_reg <= std_logic_vector( temp_var(repack_reg'range) );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks,
Omer
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page