Abi88
Newbie level 4
hi all...i am trying on codes for shift register...does anyone can help me to write a test codes so that i can try them out? pls guide too where to input n output the pins on UP2 board using CPLD..thanks!
library ieee;
use ieee.std_logic_1164.all;
entity shift_register4 is
port(reset: in std_logic; clk: in std_logic; si: in std_logic;
s0: out std_logic; q: out std_logic_vector (3 downto 0));
end entity shift_register4;
architecture behavioural of shift_register4 is
signal shift : std_logic_vector (3 downto 0);
begin
process(si,clk,reset)
begin
if (reset = '1')then
shift <= "0000";
elsif (clk'event and (clk = '1')) then
shift <= shift(2 downto 0) & si;
end if;
end process;
q <= shift;
s0 <=shift(3);
end behavioural;
thanks!!!
library ieee;
use ieee.std_logic_1164.all;
entity shift_register4 is
port(reset: in std_logic; clk: in std_logic; si: in std_logic;
s0: out std_logic; q: out std_logic_vector (3 downto 0));
end entity shift_register4;
architecture behavioural of shift_register4 is
signal shift : std_logic_vector (3 downto 0);
begin
process(si,clk,reset)
begin
if (reset = '1')then
shift <= "0000";
elsif (clk'event and (clk = '1')) then
shift <= shift(2 downto 0) & si;
end if;
end process;
q <= shift;
s0 <=shift(3);
end behavioural;
thanks!!!