Professional Documents
Culture Documents
http://vhdlbasic.blogspot.in/2013/06/vhdl-code-for-flip-flops.html 1/7
6/13/2014 VHDL Codes for Flip flops
[http://4.bp.blogspot.com/-
EBZx_rVty8g/UZzlO0M2sPI/AAAAAAAAAD8/luzfU9abCvI/s1600/Capture.JPG]
library ieee;
use ieee. std_logic_1164.all;
use ieee. std_logic_arith.all;
use ieee. std_logic_unsigned.all;
entity SR-FF is
PORT( S,R,CLOCK,CLR,PRESET: in std_logic;
Q, QBAR: out std_logic);
end SR-FF;
elsif(PRESET='0')then
x:='1';
else
x:='1';
http://vhdlbasic.blogspot.in/2013/06/vhdl-code-for-flip-flops.html 2/7
6/13/2014 VHDL Codes for Flip flops
end if;
end if;
Q<=x;
QBAR<=not x;
end PROCESS;
end behavioral;
[http://2.bp.blogspot.com/-
AoatpdknKns/UZztN98ANjI/AAAAAAAAAEM/VWghgFNlIvU/s1600/Capture.JPG]
library ieee;
use ieee. std_logic_1164.all;
use ieee. std_logic_arith.all;
use ieee. std_logic_unsigned.all;
entity D-FF is
PORT( D,CLK,RST: in std_logic;
Q: out std_logic);
end D-FF;
begin
P1: process(RST,CLK)
begin
if(RST='1')then
http://vhdlbasic.blogspot.in/2013/06/vhdl-code-for-flip-flops.html 3/7
6/13/2014 VHDL Codes for Flip flops
Q<='0';
-->
[http://3.bp.blogspot.com/-
lNx-
OS84Rvc/UZzyTXVkyBI/AAAAAAAAAEc/tXlmyWSO3S4/s1600/Capt
ure.JPG]
library ieee;
use ieee. std_logic_1164.all;
use ieee. std_logic_arith.all;
use ieee. std_logic_unsigned.all;
entity JK-FF is
PORT( J,K,CLK,PRST,CLR: in std_logic;
Q, QB: out std_logic);
end JK-FF;
http://vhdlbasic.blogspot.in/2013/06/vhdl-code-for-flip-flops.html 4/7
6/13/2014 VHDL Codes for Flip flops
x:='0';
elsif(PRST='0')then
x:='1';
end if;
end if;
Q<=x;
QB<=not x;
end PROCESS;
end behavioral;
Attributes in VHDL
Sequential statements in …
VHDL Process
[http://4.bp.blogspot.com/-
Concurrent Statements in… r5TZPHLveLE/UZz3TlNl2pI/AAAAAAAAAE0/S1-
dMs9yWCs/s1600/Capture.JPG]
Basic definitions in VHDL
http://vhdlbasic.blogspot.in/2013/06/vhdl-code-for-flip-flops.html 5/7
6/13/2014 VHDL Codes for Flip flops
library ieee;
Statements in VHDL
use ieee. std_logic_1164.all;
use ieee. std_logic_arith.all;
Introducing VHDL Basics use ieee. std_logic_unsigned.all;
entity T-FF is
PORT( T,CLK,PRST,RST: in std_logic;
Q: out std_logic);
end T-FF;
begin
P1: process(CLK,PRST,RST)
variable x: std_logic;
begin
if(RST='0') then
x:='0';
x:='1';
if(T='1')then
x:= not x;
end if;
end if;
Q<=x;
end process;
end behavioral;
One thing that is noticeable in these Flip Flop codes is that in the
processes, the input signals weren't included. This is because in a FF,
as long as their is no clock, the input can't alter the output. If we
include the inputs in the sensitivity list of the processes, then the code
will run and the FF will give an output even if there is no clock which
would be wrong.
Posted 16th June 2013 by Princess
2 View comments
http://vhdlbasic.blogspot.in/2013/06/vhdl-code-for-flip-flops.html 6/7
6/13/2014 VHDL Codes for Flip flops
(coding) four individual JK flip flops, we can simply code a common structure
and simply place the desired connections on variables/signals. You need a
synchronous counter that means the clock is same to all flip flop units but
rest remains the same. Make a structure and use it with the same clock
signal but different pin allocations 4 times. Your problem will be solved.
Some structural approach based programs will be posted by us shortly.
Stay tuned!
Reply
Publish Preview
http://vhdlbasic.blogspot.in/2013/06/vhdl-code-for-flip-flops.html 7/7