Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - SR Flip Flop

 
Thread Tools Search this Thread
Old 10-29-2006, 06:58 PM   #1
Default SR Flip Flop


Hi,

Just started learning VHDL, and trying to code up a S-R Flip flop with
async reset.

Here is what I got, believe this is correct.

Any thing I am missing?

Thanks,

RishiD

achitecture SR of SRFF is
signal Qint : STD_LOGIC;
begin
process (clk, reset) begin
if (reset = '1' and s = '1') then
Qint <= 'X';
elsif (reset = '1' and s = '0') then
Qint <= '0';
elsif (clk'event AND clk = '1') then
if (s = '1') then
Qint <= '1';
end if;
end if;
end process;
Q <= Qint;
end SR;



RishiD
  Reply With Quote
Old 10-29-2006, 07:40 PM   #2
phong
Junior Member
 
Join Date: Oct 2006
Posts: 1
Default
achitecture SR of SRFF is
signal Qint : STD_LOGIC;
begin
process (clk, reset) begin
if (reset = '1') then
Qint <= '0'; -- or '1';
elsif (clk'event AND clk = '1') then
if (s = '1') then Qint <= '1';
else Qint <= Qint;
end if;
end if;
end process;
Q <= Qint;
end SR;


phong
phong is offline   Reply With Quote
Old 10-30-2006, 12:19 PM   #3
Ralf Hildebrandt
 
Posts: n/a
Default Re: SR Flip Flop
RishiD schrieb:

> Just started learning VHDL, and trying to code up a S-R Flip flop with
> async reset.


SR-flipflop? Unfortunately there is no unique meaning behind this word.

Usually it is called RS-flipflop. Unfortunately a lot of professors do
not mean and edge-sensitive register (a flipflop) with this, but a
"RS-latch" - a level sensitive register.

If you really mean a flipflop there is the possibility of
* both async set and reset
* one async set or reset and one sync reset or set
* both sync set and reset.

> process (clk, reset) begin
> if (reset = '1' and s = '1') then
> Qint <= 'X';
> elsif (reset = '1' and s = '0') then
> Qint <= '0';
> elsif (clk'event AND clk = '1') then
> if (s = '1') then
> Qint <= '1';
> end if;
> end if;
> end process;


You try to model a flipflop with async reset and sync set. But why do
you try to assign an 'X' to Qint if the synchronous set and the
asynchronous reset are active? For the RS-latch it is forbidden to
activate the async set and the async reset simultaneously. But for a
flipflop?

Furthermore two RS-latches forming a master/slave flipflop are quite
uncommon in todays cell libraries. D-type flipflops are common.

-- D-flipflop with async set+reset and sync set/reset:
process (clk, async_reset, async_set) begin
if (async_reset='1') then
Qint <= '0';
elsif (async_set = '1') then
Qint <= '1';
elsif (clk'event AND clk = '1') then
if (sync_set = '1') then
Qint <= '1';
elsif (sync_reset='1') then
Qint <='0';
else
Qint <= data_in;
end if;
end if;


Ralf


Ralf Hildebrandt
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46