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

4bit siso shift register

Altera_Forum
Honored Contributor II
3,008 Views

I used the following code for 4bit siso shift register. 

 

 

Signal temp : std_logic_vector( 3downtown 0); 

begin 

process 

begin 

if(rising_edge(clk)) then 

temp(3 downtown 1)<=temp(2 downto 0); 

temp(0)<=si; 

end if; 

end process; 

so<=temp(3); 

end behavioural; 

 

 

I used the following testbench code. 

clk<= '0'; 

si<='1'; 

wait for 100ns; 

 

clk<= '1'; 

si<='1'; 

wait for 100ns; 

 

But after stimulation its shows that so is undefined i.e 

a red bar is shown.... 

Pls help......
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
1,806 Views

You only show a single clock in the testbench code. It will take 4 clocks for si to propogate to so.

0 Kudos
Altera_Forum
Honored Contributor II
1,806 Views

clk<= '0'; 

si<='1'; 

wait for 100ns; 

 

clk<= '1'; 

si<='1'; 

wait for 100ns; 

clk<= '0'; 

si<='1'; 

wait for 100ns; 

 

clk<= '1'; 

si<='1'; 

wait for 100ns; 

clk<= '0'; 

si<='1'; 

wait for 100ns; 

 

clk<= '1'; 

si<='1'; 

wait for 100ns; 

clk<= '0'; 

si<='1'; 

wait for 100ns; 

 

clk<= '1'; 

si<='1'; 

wait for 100ns; 

I have used the above coding..... 

Even if I use 4 clocks its still shows the red bar
0 Kudos
Altera_Forum
Honored Contributor II
1,806 Views

Pls help.....

0 Kudos
Altera_Forum
Honored Contributor II
1,806 Views

Please post all of your code, not just an extract.

0 Kudos
Altera_Forum
Honored Contributor II
1,806 Views

did you try to initialize temp(3 downto 0) to an initial value? If not you need at least 4 clock edges to get "so" "green" 

if "red" it would be that you never put anything on it...
0 Kudos
Altera_Forum
Honored Contributor II
1,806 Views

AND , you have to put "clock" in the process sensitivity list....

0 Kudos
Reply