Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Memory in asynchronous FPGA design

Status
Not open for further replies.

shaiko

Advanced Member level 5
Joined
Aug 20, 2011
Messages
2,644
Helped
303
Reputation
608
Reaction score
297
Trophy points
1,363
Activity points
18,300
Code:
process ( not_a_clock_signal ) is 
   begin
     if rising_edge (not_a_clock_signal) then
        Q <= D ;
     end if ;
   end process ;


process ( enable ) is 
   begin
     if enable = '1' then
        Q <= D ;
     end if ;
   end process ;

The first process describes a DFF with a gated clock while the second process describes a transparent D latch.
Am I correct ?
 

K-J

Advanced Member level 2
Joined
Jan 26, 2012
Messages
658
Helped
308
Reputation
620
Reaction score
301
Trophy points
1,343
Activity points
7,053
Yes.................
 
  • Like
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating

shaiko

Advanced Member level 5
Joined
Aug 20, 2011
Messages
2,644
Helped
303
Reputation
608
Reaction score
297
Trophy points
1,363
Activity points
18,300
If you where dealing with an asynchronous FPGA design - which of the above memories would you use?
 

xtcx

Advanced Member level 1
Joined
Dec 22, 2007
Messages
494
Helped
65
Reputation
130
Reaction score
58
Trophy points
1,308
Location
Bangalore, India
Activity points
5,003
Gated clock, it is not asynchronous !!!

Anyway,
Both are risky infact, if not used properly. Gated clock\Latch :)
 

K-J

Advanced Member level 2
Joined
Jan 26, 2012
Messages
658
Helped
308
Reputation
620
Reaction score
301
Trophy points
1,343
Activity points
7,053
If you where dealing with an asynchronous FPGA design - which of the above memories would you use?

For starters, I wouldn't deal with an asynchronous FPGA design (at least not with FPGAs as they exist today that I commonly work with...maybe there are some that are good for async designs). But I would use the first memory form that you presented...connected to a free running clock input signal.

Kevin Jennings
 

shaiko

Advanced Member level 5
Joined
Aug 20, 2011
Messages
2,644
Helped
303
Reputation
608
Reaction score
297
Trophy points
1,363
Activity points
18,300
The clock isn't present at all.
The design is completely asynchronous - in that case would you use latches or FFs ?
 

K-J

Advanced Member level 2
Joined
Jan 26, 2012
Messages
658
Helped
308
Reputation
620
Reaction score
301
Trophy points
1,343
Activity points
7,053
The clock isn't present at all.
The design is completely asynchronous - in that case would you use latches or FFs ?

I would first find a device family that would be appropriate for asynchronous designs, study that architecture and make a decision based on that new understanding. It wouldn't be a simple 'this' or 'that' decision applicable across the board to any type of device.

Kevin Jennings
 
  • Like
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating

xtcx

Advanced Member level 1
Joined
Dec 22, 2007
Messages
494
Helped
65
Reputation
130
Reaction score
58
Trophy points
1,308
Location
Bangalore, India
Activity points
5,003
The clock isn't present at all.

What do you mean clock is not present. The DFF without a clock is not a design and no event triggers.

If gated clocks are driven properly, I would say, gated clock design is better for that, than writing data through latch. Gated clocks are not a good practice but it has some benefits though, however it is upto the designer how to gate it.

Final part, gated clocks are better to suit.

---------- Post added at 15:42 ---------- Previous post was at 15:40 ----------

I would first find a device family that would be appropriate for asynchronous designs, study that architecture and make a decision based on that new understanding. It wouldn't be a simple 'this' or 'that' decision applicable across the board to any type of device.

Kevin Jennings

Mmm....I think shaiko expects an answer; Perhaps yes or no stuff
like FF or gated clock :)
 

K-J

Advanced Member level 2
Joined
Jan 26, 2012
Messages
658
Helped
308
Reputation
620
Reaction score
301
Trophy points
1,343
Activity points
7,053
If gated clocks are driven properly, I would say, gated clock design is better for that, than writing data through latch. Gated clocks are not a good practice but it has some benefits though, however it is upto the designer how to gate it.
- Gated clocks are one entry way to learning about the topic called 'hold time violations'.
- Latches are an entry way to learning about the topic called 'race conditions' or 'logic hazards'

This is not to imply that gated clocks or latches always will lead you down that path, but if you haven't mastered the topics that I mentioned ahead of time, then eventually you will learn about them in a debug situation via your usage of such design elements.

Final part, gated clocks are better to suit.
Pop quiz...explain the basis for your statement...answer the question 'Why?'

Mmm....I think shaiko expects an answer; Perhaps yes or no stuff like FF or gated clock :)
I'm sure he did...and I'm sure he appreciated my actual answer as well.

Kevin Jennings
 
  • Like
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating

shaiko

Advanced Member level 5
Joined
Aug 20, 2011
Messages
2,644
Helped
303
Reputation
608
Reaction score
297
Trophy points
1,363
Activity points
18,300
The DFF without a clock is not a design and no event triggers
I disagree with the above statement.
In the code below, "some_signal" will trigger the DFF even with the clock at idle.
Code:
process ( clock ) is 
  begin
    if rising_edge ( some_signal ) then
       Q <= D ;
    end if ;
  end process
 

dave9000

Full Member level 2
Joined
Dec 5, 2011
Messages
146
Helped
40
Reputation
80
Reaction score
38
Trophy points
1,308
Activity points
2,129
In the code below, "some_signal" will trigger the DFF even with the clock at idle.
Code:
process ( clock ) is 
  begin
    if rising_edge ( some_signal ) then
       Q <= D ;
    end if ;
  end process
That's a strange process indeed: "clock" is in the sensitivity list but you want the data to be sampled with "some_signal"? I can't imagine this working in simulation, let alone being implemented by any hardware at all.
You should think in terms of real synthesizable hardware, that's only flip-flops (D, T, JK, SR) and latches - what else?
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
49,404
Helped
14,439
Reputation
29,142
Reaction score
13,233
Trophy points
1,393
Location
Bochum, Germany
Activity points
284,324
The signal connected to the clock input of a DFF is analysed as clock by the synthesis tool, in so far you can say, that a DFF doesn't work without a clock.

But your intention is rather clear. I expect, that in an asynchronous design DFFs using "data as clock" would be preferred over latches in most cases. In my opinion, the term "gated clock" doesn't describe the situation well.

I think, the problem could be better dicussed referring to a real asynchronous design example.
 
  • Like
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating

shaiko

Advanced Member level 5
Joined
Aug 20, 2011
Messages
2,644
Helped
303
Reputation
608
Reaction score
297
Trophy points
1,363
Activity points
18,300
That's a strange process indeed: "clock" is in the sensitivity list but you want the data to be sampled with "some_signal"? I can't imagine this working in simulation, let alone being implemented by any hardware at all.
You should think in terms of real synthesizable hardware, that's only flip-flops (D, T, JK, SR) and latches - what else?

Sorry dave9000,
My mistake I meant:

Code:
process ( some_signal ) is 
  begin
    if rising_edge ( some_signal ) then
       Q <= D ;
    end if ;
  end process
 

xtcx

Advanced Member level 1
Joined
Dec 22, 2007
Messages
494
Helped
65
Reputation
130
Reaction score
58
Trophy points
1,308
Location
Bangalore, India
Activity points
5,003
Sorry dave9000,
My mistake I meant:

Code:
process ( some_signal ) is 
  begin
    if rising_edge ( some_signal ) then
       Q <= D ;
    end if ;
  end process

When you put with naming clock, it is by the way we would take it as CLOCK only...
Even if you mention it as some other net, the tool will still take it as clock only, and will calculate timings for this "some_signal" path

But this is not a gated-clock. The figure below is the gated-clock example.
A gated clock terminology is to control the clock flow into one particular network which has only 1 reason to go with "Power Control".

Here your code does latching only ("D" is latched to Q based on some_signal rising event)

I don't see any difference other than the way of coding between your 2 cases, if this some_signal is "Data signal" instead of "clock"
 

Attachments

  • gated_clock.jpg
    gated_clock.jpg
    4.8 KB · Views: 54

xtcx

Advanced Member level 1
Joined
Dec 22, 2007
Messages
494
Helped
65
Reputation
130
Reaction score
58
Trophy points
1,308
Location
Bangalore, India
Activity points
5,003
- Gated clocks are one entry way to learning about the topic called 'hold time violations'.
- Latches are an entry way to learning about the topic called 'race conditions' or 'logic hazards'

This is not to imply that gated clocks or latches always will lead you down that path, but if you haven't mastered the topics that I mentioned ahead of time, then eventually you will learn about them in a debug situation via your usage of such design elements.

Pop quiz...explain the basis for your statement...answer the question 'Why?'


I'm sure he did...and I'm sure he appreciated my actual answer as well.

Kevin Jennings

Yeah yeah...sure he did indeed, but I just meant to say sometimes an answer (yes\no) wouldbe perfect. Also, I brought up the answer with not_clock_signal as a clock but shaiko later confirmed it as a signal.

Cheers...
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top