Professional Documents
Culture Documents
Flipflops
Flipflops
Code:
--jk flipflop
--UGA BUGA
library ieee; use
ieee.std_logic_1164.all;
entity jk_flipflop is
port(j,k,clk: in std_logic; q,ql : out std_logic);
end jk_flipflop;
Code:
--UGA BUGA
--SR FLIPFLOP using if-then
library ieee;
use ieee.std_logic_1164.all;
entity SR is port(S,R,CLK:in
std_logic;
Q,Qb:out std_logic);
end SR;
architecture beh of SR is
begin; process(S,R,CLK);
variable temp: std_logic;
begin;
Q<=temp;
Qb <=not temp;
end process; end
beh;
3) MUX 8:1
Code :
-- MUX 8:1
--UGA BUGA
library ieee;
use ieee.std_logic_1164.all;
entity mux8 is
port(I: in std_logic_vector(7 downto 0);
sel: in std_logic_vector(2 downto 0); Y: out std_logic); end mux8;
library ieee;
use ieee.std_logic_1164.all;
entity bcd7 is
Port ( INPUT : in STD_LOGIC_VECTOR (3 downto 0);
OUTPUT_SEVEN_SEGMENT : out STD_LOGIC_VECTOR (6 downto 0));
end bcd7;
INPUT[3..0]
OUTPUT_SEVEN_SEGMENT[6..0]
5) 4-bit Comparator :
Code :
--UGA BUGA
library
ieee;
use ieee.std_logic_1164.all;
entity fourbitComparator is
port (A,B : in std_logic_vector(3 downto 0);
G,E,L: out std_logic);
end fourbitComparator;
= LE SS _ TH A
E qu a l0N
A[3..0]
A[3..0] E
LessThan1 B[3..0]
B[3..0]
<
< L LEeQsUsALThan0
A[3..0]
B[3..0] G
LESS_THAN
A[3..0]
B[3..0]