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 on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17268 Discussions

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

Altera_Forum
Honored Contributor II
2,912 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,384 Views

variable temp2 : std_logic_vector(2 downto 0); 

 

.... 

 

temp2 := temp(5 downto 3);
0 Kudos
Altera_Forum
Honored Contributor II
1,384 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,384 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