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

PISO (4 bit parallel in serial out shift reigster)

Altera_Forum
Honored Contributor II
12,487 Views

Hello, I'm trying to create a simple 4-bit parallel in and serial out shift register.  

 

So far, here is what I have: 

 

 

--- Quote Start ---  

LIBRARY ieee; 

USE ieee.std_logic_1164.all; 

USE ieee.std_logic_arith.all; 

USE ieee.std_logic_unsigned.all;  

 

ENTITY shift IS 

PORT ( 

sout : out std_logic; 

p : IN std_logic_vector (3 DOWNTO 0); 

clr, sin, load : IN std_logic; 

clk : IN std_logic 

); 

END shift; 

 

ARCHITECTURE bhv OF shift IS 

signal qlatch: std_logic_vector(3 downto 0); 

begin  

process (CLR, CLK) 

begin  

 

if (clr = '1') then 

qlatch <= "0000";  

elsif (CLK'event and CLK='1') then  

if (LOAD='0') then  

qlatch <= '0' & p(3 downto 1); 

end if; 

end if;  

end process; 

sout <= qlatch(3); 

end bhv; 

 

--- Quote End ---  

 

 

Now, the code itself compiles; however, when I try to test its functionality on my board (EPM7128SLC84-15), nothing happens. 

 

If anyone has any suggestion or point out any errors, it would be greatly appreciated. Thank you.
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
8,796 Views

 

--- Quote Start ---  

Hello, I'm trying to create a simple 4-bit parallel in and serial out shift register.  

 

So far, here is what I have: 

 

 

 

Now, the code itself compiles; however, when I try to test its functionality on my board (EPM7128SLC84-15), nothing happens. 

 

If anyone has any suggestion or point out any errors, it would be greatly appreciated. Thank you. 

--- Quote End ---  

 

 

My guess, I believe it should be: 

sout <= qlatch(0);
0 Kudos
Altera_Forum
Honored Contributor II
8,796 Views

 

--- Quote Start ---  

My guess, I believe it should be: 

sout <= qlatch(0); 

--- Quote End ---  

 

 

Didn't work. 

 

I believe that line just takes that specific bit in the 4 bits, but doesn't actually shift.
0 Kudos
Altera_Forum
Honored Contributor II
8,796 Views

 

--- Quote Start ---  

Didn't work. 

 

I believe that line just takes that specific bit in the 4 bits, but doesn't actually shift. 

--- Quote End ---  

 

 

but you shift statement is from msb to lsb i.e. bit3 starts as zero then bit2 then bit1 then bit0. So bit 3 will always be zero
0 Kudos
Altera_Forum
Honored Contributor II
8,796 Views

 

--- Quote Start ---  

but you shift statement is from msb to lsb i.e. bit3 starts as zero then bit2 then bit1 then bit0. So bit 3 will always be zero 

--- Quote End ---  

 

 

you also need to load qlatch with input first at load then start the shift. You are just assigning input 3 bits to qlatch
0 Kudos
Reply