entity dff is
port(d,clk: in bit;q,qn:buffer bit);
end dff;
begin
entity nor2 is
port(a,b:in bit;z:out bit);
end nor2;
architecture df of nor2 is
begin
z<=a nor b after 1ns;
end df;
entity nor3 is
port(a,b,c:in bit;z:out bit);
end nor3;
architecture df of nor3 is
begin
z<=not(a or b or c) after 1ns;
end df;
entity inv is
i)
D flip flop
Z1
0
0
0
0
1
1
1
1
Z0
0
0
1
1
0
0
1
1
X
0
1
0
1
0
1
0
1
Z1
0
0
1
0
0
1
1
0
Z0
0
1
0
1
0
1
0
1
D1
0
0
1
0
0
1
1
0
D0
0
1
0
1
0
1
0
1
Y
0
0
0
0
0
0
0
1
Code: Assume all necessary components are provided and just follow the circuit diagram.
entity d_flipflop is
port(x,clk: in bit; y: out bit);
end d_flipflop;
architecture struc of d_flipflop is
signal xn,s2,s3,s4,s0,s0n,s1,s1n:bit;
component d_flip
port(d,clk:in bit; q, qn:out bit);
end component;
component AND2
port(a,b :in bit;z:out bit);
end component;
component AND3
port(a,b,c:in bit; z:out bit);
end component;
component OR2
port(a,b:in bit; z:out bit);
end component;
component INVERTER
port(a:in bit; z:out bit);
end component;
begin
ii)
T flip flop
Z1
0
0
0
0
1
1
1
1
Z0
0
0
1
1
0
0
1
1
X
0
1
0
1
0
1
0
1
Z1
0
0
1
0
0
1
1
0
Code:
entity t_flipflop is
port(x,clk: in bit; y: out bit);
end t_flipflop;
Z0
0
1
0
1
0
1
0
1
T1
0
0
1
0
1
0
0
1
T0
0
1
1
0
0
1
1
0
Y
0
0
0
0
0
0
0
1
end struc;
iii)
Jk Flip flop
Z1
0
0
0
0
1
1
1
1
Z0
0
0
1
1
0
0
1
1
X
0
1
0
1
0
1
0
1
Z1
0
0
1
0
0
1
1
0
Z0
0
1
0
1
0
1
0
1
J1 = Z0.X; K1 = X+Z0
J0 = X; K0 = X
Y = Z1.Z0.X
Code:
entity jk_flipflop is
port(x,clk: in bit; y: out bit);
end jk_flipflop;
J1
0
0
1
0
X
X
X
X
K1
X
X
X
X
1
0
0
1
J0
0
1
X
X
0
1
X
X
K0
X
X
1
0
X
X
1
0
Y
0
0
0
0
0
0
0
1
begin
process(Clock, D)
begin
if Clock='1' then
case n_s is
when s1=>
Z <= '0';
if (D='1') then
n_s <= s2;
end if;
when s2=>
Z <= '0';
if D='0' then
n_s <= s3;
end if;
when s3=>
Z <= '0';
if D='1' then
n_s <= s4;
else
n_s <= s1;
end if;
when s4=>
if D='1' then
Z <= '1';
n_s <= s1;
else
n_s <= s3;
end if;
end case;
end if;
end process;
end behav;
Question 4:
Z3
0
0
0
0
Z2
0
0
0
0
Z1
0
0
1
1
Z0
0
1
0
1
Z3
0
0
0
0
Z2
0
0
0
1
Z1
0
1
1
0
Z0
1
0
1
0
J3
0
0
0
0
K3
X
X
X
X
J2
0
0
0
1
K2
X
X
X
X
J1
0
1
X
X
K1
X
X
0
1
0
0
0
1
1
1
1
1
0
0
0
1
1
0
0
0
0
1
0
1
J3 =Z2Z1Z0; K3 = Z0
J2 = Z1Z0; K2 = Z1Z0
J1 = Z3Z0; K1=Z0
0
0
1
1
0
1
1
0
0
0
0
1
0
0
0
1
1
0
1
0
0
0
1
X
X
X
X
X
0
1
X
X
X
0
0
0
0
1
X
X
1
X
X
0
0
X
0
1
X
X