Question

Write the VHDL code for RS Flip flop.

Write the VHDL code for RS Flip flop.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Truth table for RS Flip Flop

Q R S Q(N+1)

0 0 0 0(Memory state same as Q)

0 0 1 1

0 1 0 0

0 1 1 UNKNOWN

1 0 0 1(Memory state same as Q)

1 0 1 0

1 1 0 1

1 1 1 UNKNOWN

CODE BELOW

library ieee;

use ieee. std_logic_1164.all;

entity SR-FF is

PORT( S,R,CLOCK: in std_logic ; Q , QBAR: out std_logic);

end SR-FF;

Architecture behavioral of SR-FF is

begin

PROCESS(CLOCK)

variable x: std_logic;

begin

if(CLOCK='1' and CLOCK'EVENT) then

if(S='0' and R='0')then

x:=x;

elsif(S='1' and R='1')then

x:='Z';

elsif(S='0' and R='1')then

x:='0';

else

x:='1';

end if;

end if;

Q<=x;

QBAR<=not x;

end PROCESS;

end behavioral

Add a comment
Know the answer?
Add Answer to:
Write the VHDL code for RS Flip flop.
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT