I'm building an 8-bit register from d-type flipflops in VHDL for a lab exercise but I can't seem to diagnose a problem. Firstly I can't get it to compile because of the difference in types for the input clock. My project is called eightBitRegister
so its not because my definition uses a different name. So if I change this to the correct type I get the error:
Error: Top-level design entity "eightBitRegister" is undefined
The VHDL when this occurs looks like:
LIBRARY ieee ;
USE ieee.std_logic_1164.all ;
ENTITY eigthBitRegister IS
PORT ( Clock: in BIT;
Data: in BIT ;
Q: out BIT) ;
END eigthBitRegister ;
ARCHITECTURE Behaviour OF eigthBitRegister IS
COMPONENT flipflop is
PORT ( D: in BIT ; Clock: in BIT;
Q: out BIT) ;
END COMPONENT;
SIGNAL QOut: BIT_VECTOR(7 downto 0);
begin
Stages: for i in 7 downto 0 generate
LowBit: if i = 0 generate
ff:flipflop PORT MAP(Data, Clock, QOut(0));
end generate;
OtherBits: if i /= 0 generate
ff:flipflop PORT MAP(QOut(i-1), Clock, QOut(i));
end generate;
end generate;
Q <= QOut(7);
END;
However if I change it to this:
LIBRARY ieee ;
USE ieee.std_logic_1164.all ;
ENTITY eigthBitRegister IS
PORT ( Clock: in STD_LOGIC;
Data: in BIT ;
Q: out BIT) ;
END eigthBitRegister ;
ARCHITECTURE Behaviour OF eigthBitRegister IS
COMPONENT flipflop is
PORT ( D: in BIT ; Clock,
Q: out BIT) ;
END COMPONENT;
SIGNAL QOut: BIT_VECTOR(7 downto 0);
begin
Stages: for i in 7 downto 0 generate
LowBit: if i = 0 generate
ff:flipflop PORT MAP(Data, Clock, QOut(0));
end generate;
OtherBits: if i /= 0 generate
ff:flipflop PORT MAP(QOut(i-1), Clock, QOut(i));
end generate;
end generate;
Q <= QOut(7);
END;
It can find the top-level identity and get the error:
Error (10476): VHDL error at eightBitRegister.vhd(22): type of identifier "Clock" does not agree with its usage as "bit" type
So whats going wrong?