C
coderyogi
Guest
I have written a vhdl code in xilinx for a serial in serial out shift
register. It is modelled using 4 d flip flops. The problem is that the
output waveform is coming as an undefined signal.
[code:1:98ed31fa66]
--D FLIP FLOP FILE
entity dff is
Port ( d : in STD_LOGIC;
clk : in STD_LOGIC;
clr : in STD_LOGIC;
q : out STD_LOGIC);
end dff;
architecture Behavioral of dff is
begin
process (clk, clr)
begin
if clr = '0' then
q <= '0';
elsif clk 'event and clk = '1'
q <= d;
end if;
end process;
end Behavioral;
-- SHIFT REGISTER FILE
entity pmshreg is
Port ( inp : in STD_LOGIC;
clk : in STD_LOGIC;
clr : in STD_LOGIC;
outp : out STD_LOGIC);
end pmshreg;
architecture Behavioral of pmshreg is
component dff is
Port ( d : in STD_LOGIC;
clk : in STD_LOGIC;
clr : in STD_LOGIC;
q : out STD_LOGIC);
end component;
signal temp: STD_LOGIC_VECTOR (4 downto 0);
begin
temp(4) <= inp;
lab: for i in 0 to 3 generate
ins: dff port map (temp(4 - i), clk, clr, temp(4 - (i + 1)));
end generate;
outp <= temp(0);
end Behavioral;
[/code:1:98ed31fa66]
If anybody can help, thanks...
register. It is modelled using 4 d flip flops. The problem is that the
output waveform is coming as an undefined signal.
[code:1:98ed31fa66]
--D FLIP FLOP FILE
entity dff is
Port ( d : in STD_LOGIC;
clk : in STD_LOGIC;
clr : in STD_LOGIC;
q : out STD_LOGIC);
end dff;
architecture Behavioral of dff is
begin
process (clk, clr)
begin
if clr = '0' then
q <= '0';
elsif clk 'event and clk = '1'
q <= d;
end if;
end process;
end Behavioral;
-- SHIFT REGISTER FILE
entity pmshreg is
Port ( inp : in STD_LOGIC;
clk : in STD_LOGIC;
clr : in STD_LOGIC;
outp : out STD_LOGIC);
end pmshreg;
architecture Behavioral of pmshreg is
component dff is
Port ( d : in STD_LOGIC;
clk : in STD_LOGIC;
clr : in STD_LOGIC;
q : out STD_LOGIC);
end component;
signal temp: STD_LOGIC_VECTOR (4 downto 0);
begin
temp(4) <= inp;
lab: for i in 0 to 3 generate
ins: dff port map (temp(4 - i), clk, clr, temp(4 - (i + 1)));
end generate;
outp <= temp(0);
end Behavioral;
[/code:1:98ed31fa66]
If anybody can help, thanks...