Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17267 Discussions

how to get part of variable of type std_logic_vector like substring function

Altera_Forum
Honored Contributor II
2,901 Views

for example 

 

temp : std_logic_vector[31 downto 0]  

 

just want to get starting from 3th bit to 5th bit and store to another variable of type std_logic_vector[2 downto 0] 

 

like offset 

 

how to write in vhdl?
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
1,373 Views

variable temp2 : std_logic_vector(2 downto 0); 

 

.... 

 

temp2 := temp(5 downto 3);
0 Kudos
Altera_Forum
Honored Contributor II
1,373 Views

i mean temp2 : std_logic_vector(6 downto 0) := "011011" 

 

if want to get from bit 3 to bit 5 which is 101 

 

does it need to write a substring function or is there a function that can do this?
0 Kudos
Altera_Forum
Honored Contributor II
1,373 Views

I dont quite understand what you mean. You can slice an array like I showed you. 

 

temp3 := temp2(5 downto 3);
0 Kudos
Reply