Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.

shifting in quartus ii

Altera_Forum
Honored Contributor II
1,793 Views

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, 

Omer
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
863 Views

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) );
0 Kudos
Altera_Forum
Honored Contributor II
863 Views

thanks, 

Omer
0 Kudos
Reply