Académique Documents
Professionnel Documents
Culture Documents
VHDL CODE:
library ieee;
use ieee.std_logic_1164.all;
entity count_beh is
port(clock,reset,dir:in bit;q:out bit_vector(2 downto 0));
end count_beh;
begin
process (clock)
begin
if clock='1' then
q<=nextstate;
prestate<=nextstate;
end if;
end process;
process(dir,reset,prestate)
begin
if reset='1' then
nextstate<="000";
-- end if;
else
if dir='0' then
case prestate is
when "000" => nextstate<="001";
when "001" => nextstate<="010";
when "010" => nextstate<="011";
when "011" => nextstate<="100";
when "100" => nextstate<="101";
when "101" => nextstate<="000";
when "110" => nextstate<="000";
when "111" => nextstate<="000";
end case;
elsif dir='1' then
case prestate is
when "000" => nextstate<="101";
when "001" => nextstate<="000";
when "010" => nextstate<="001";
when "011" => nextstate<="010";
when "100" => nextstate<="011";
when "101" => nextstate<="100";
when "110" => nextstate<="000";
when "111" => nextstate<="000" ;
end case;
end if;
end if;
end process;
end beh_cnt;
-------------------------------------------------------------------------------------------------------
entity count_data is
port(clock,reset,dir:in bit;q:out bit_vector(2 downto 0));
end count_data;
begin
end data1_cnt;
entity and2 is
port(x,y: in bit; z: out bit);
end and2;
entity and3 is
port(x,y,t: in bit; z: out bit);
end and3;
entity or4 is
port(w,v,x,y: in bit; z: out bit);
end or4;
entity or3 is
port(v,x,y: in bit; z: out bit);
end or3;
entity nand2 is
port(x,y: in bit; z: out bit);
end nand2;
entity JKFF3 is
Port ( CLOCK : in bit;
J : in bit;
K : in bit;
RESET : in bit;
Q,Qbar : inout bit;
CLR:in bit);
end JKFF3;
architecture Behavioral of JKFF3 is
Q <= '1';
Qbar <= '0';
elsif(J='1' and K='1') then
Q <= NOT Q;
Qbar <= q;
end if;
end if;
end process;
end Behavioral;
entity syn_count6 is
port ( clk,DIR:
reset:
in bit;
in bit;
component and2
port(x,y: in bit;
z: out bit);
end component;
component and3
port(x,y,t: in bit;
z: out bit);
end component;
component or4
port(w,v,x,y: in bit;
z: out bit);
end component;
component or3
port(v,x,y: in bit;
z: out bit);
end component;
component JKFF3
port(CLOCK : in bit;
J : in bit;
K : in bit;
RESET : in bit;
Q,Qbar : inout bit;
CLR: in bit);
end component;
begin
Q2
a) Behavioral
AREA REPORT
c) JK Flip Flop
POWER REPORT
A) Behavioral
c) JK Flip Flop
TIMING REPORT
A) Behavioral
c) JK Flip Flop