Created
July 18, 2015 03:47
-
-
Save ka9e/66ac8293972132d16010 to your computer and use it in GitHub Desktop.
clocked RS-filpflop by 3 input gates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library ieee; | |
use ieee.std_logic_1164.all; | |
use ieee.std_logic_unsigned.all; | |
entity three_input_gate is | |
port ( | |
CK, S, P : in std_logic; | |
Q : out std_logic | |
); | |
end entity; | |
architecture IMP of three_input_gate is | |
begin | |
Q <= (not P) or (CK and S); | |
end IMP; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Q(n+1) = CK * S + not(P(n)) | |
-- P(n+1) = CK * R + not(Q(n)) | |
library ieee; | |
use ieee.std_logic_1164.all; | |
use ieee.std_logic_unsigned.all; | |
entity top_level is | |
port ( | |
S, R, CK : in std_logic; | |
Q, nQ : buffer std_logic | |
); | |
end entity; | |
architecture IMP of top_level is | |
component three_input_gate | |
port ( | |
CK, S, P : in std_logic; | |
Q : out std_logic | |
); | |
end component; | |
begin | |
U1 : three_input_gate | |
port map( | |
CK => CK, | |
S => S, | |
P => nQ, | |
Q => Q | |
); | |
U2 : three_input_gate | |
port map( | |
CK => CK, | |
S => R, | |
P => Q, | |
Q => nQ | |
); | |
end IMP; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment