Author Topic: Reset - Sync, Async or None At All  (Read 4812 times)

0 Members and 1 Guest are viewing this topic.

Offline rstoferTopic starter

  • Super Contributor
  • ***
  • Posts: 10088
  • Country: us
Reset - Sync, Async or None At All
« on: December 24, 2019, 02:45:50 am »
I thought I would spend a few minutes at the Xilinx site and chase down an answer to the "Asynchronous vs Synchronous Reset" question.  I wasn't expecting the most likely correct answer: No reset at all!

Well, sure, why have a reset when every flop and every bit of BlockRAM is initialized at startup.  It doesn't matter what you define as an initial value, it is getting copied in at startup.

Code is going to look weird, we're all used to doing something with 'rst' at every clocked process but it might not be necessary nor is it even guaranteed to work.

https://www.xilinx.com/support/documentation/white_papers/wp272.pdf

I have no idea how this relates to other manufacturers but it doesn't matter because I'm happy with the Xilinx world.

 
The following users thanked this post: legacy

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 8794
  • Country: ca
    • LinkedIn
Re: Reset - Sync, Async or None At All
« Reply #1 on: December 24, 2019, 03:35:13 am »
It doesn't matter what you define as an initial value, it is getting copied in at startup.
Same with Intel, however, it does matter what you define as the startup default for any registers as long as the compiler 'power-up don't care' flag is disabled.  You would only use the 'Power-up don't care' feature if your FPGA is 98% full and you want to recover some free space or improve FMAX.

Ram blocks are just copied in via bootprom.

I personally have only 1 reset in my designs, only synchronous, and it only effects a minimal number of registers.  However, my designs usually push the FMAX to the limit and I have little other choice.  Though doing it right does usually lead to cleaner code.

Async set/clr, if not implemented on dedicated register async controls, like usually in verilog code, may lead to an additional gate on every effected register's clk input.  I personally don't like that even though the compiler hides this from you.

Offline Berni

  • Super Contributor
  • ***
  • Posts: 5390
  • Country: si
Re: Reset - Sync, Async or None At All
« Reply #2 on: December 24, 2019, 08:45:02 am »
Async vs Sync depends on the FPGA architecture and application.

Altera/Intel FPGAs have a asyncrhonus master clear input in the logic blocks of a lot of there FPGAs. In that case if you are using a async reset to set that register to 0 you get no performance penalty at all since the reset is not part of the logic feeding that register.

Xilinx often don't have this and in that case using asynchronous reset could hurt your performance, those will likely work better with synchronous reset.

No reset at all however will give the best performance every time, no matter the FPGA architecture. So if you have a design that doesn't really need a reset then don't use it. Good examples being things like clock dividing counters where they just count in a circle, doesn't matter what state they start in, they just keep counting as long as there is a clock. Only pitfall being that simulating these things is annoying as registers start as undefined X, so to simulate it correctly you might need to add a reset just in simulation, or manually set it to zero at the start.
 
The following users thanked this post: Someone, daqq

Offline tggzzz

  • Super Contributor
  • ***
  • Posts: 23122
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Reset - Sync, Async or None At All
« Reply #3 on: December 24, 2019, 08:52:28 am »
Resets are, of course, useful in other situations, e.g. during testing, fault recovery, and in case the power-on power line behaviour isn't quite sufficient for the reset circuitry to work as intended.

I've always included a reset, but it doesn't have to be a classic reset signal on each and every flip flop.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline rstoferTopic starter

  • Super Contributor
  • ***
  • Posts: 10088
  • Country: us
Re: Reset - Sync, Async or None At All
« Reply #4 on: December 25, 2019, 01:28:24 am »
Async vs Sync depends on the FPGA architecture and application.

Altera/Intel FPGAs have a asyncrhonus master clear input in the logic blocks of a lot of there FPGAs. In that case if you are using a async reset to set that register to 0 you get no performance penalty at all since the reset is not part of the logic feeding that register.

Xilinx often don't have this and in that case using asynchronous reset could hurt your performance, those will likely work better with synchronous reset.

No reset at all however will give the best performance every time, no matter the FPGA architecture. So if you have a design that doesn't really need a reset then don't use it. Good examples being things like clock dividing counters where they just count in a circle, doesn't matter what state they start in, they just keep counting as long as there is a clock. Only pitfall being that simulating these things is annoying as registers start as undefined X, so to simulate it correctly you might need to add a reset just in simulation, or manually set it to zero at the start.

As I read the Xilinx white paper, every single flop and every bit in BlockRAM is going to be copied from the platform flash at startup.  Whether I want all my flops to default to '0' or I want to provide a different initial condition, it doesn't matter.  The platform flash will have that initial condition.

I'm going to assume that the device comes out of reset properly because it is Xilinx recommending against my coding a reset.

For my next project, I'm going to skip the reset signal and see how it works.

Fixing up the initial conditions in the test bench seems like the best approach.

OR...

Just keep on doing what I am doing and leave the heavy thinking to others.

 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 17805
  • Country: fr
Re: Reset - Sync, Async or None At All
« Reply #5 on: December 25, 2019, 01:42:14 am »
The most rational answer here is like with any other non-trivial topic...: it depends.

I personally always use reset signals and have never even used signal initialization. My rationale is that, unless I'm mistaken, signal initialization is not synthesizable in general (it is with many FPGAs, but not quite all, and there's a life with HDLs beyond FPGAs.) Unless I design very very specific stuff tied to some specific FPGA, I usually write code that can be synthesized unmodified also for ASICs.

Then async vs sync, that really depends on 1/ the requirements (in some cases, sync resets are more appropriate as the behavior is 100% predictable at the clock pulse level) and/or 2/ difficulties to meet timings. If neither are a concern, I've found async resets to be fine on all FPGAs I've used and I've used them liberally. I'm certainly not in the fanatic camp of those that are against any form of async resets no matter what. Even on Xilinx FPGAs.

The "no-reset" approach, apart from the point above (of signal init. not being synthesizable in the general case - but you may not care if you're dead sure you're never ever gonna use your code on any other target than one that is fine with this, or if you don't care about initial state), has another, obvious problem: you have no way to reset outside of ROC (reset on config), which may be OK in some cases, or not in others.

Just my 2 cents.
« Last Edit: December 25, 2019, 01:44:34 am by SiliconWizard »
 
The following users thanked this post: emece67

Offline emece67

  • Frequent Contributor
  • **
  • !
  • Posts: 614
  • Country: 00
Re: Reset - Sync, Async or None At All
« Reply #6 on: December 25, 2019, 02:11:10 pm »
.
« Last Edit: August 19, 2022, 02:43:05 pm by emece67 »
 
The following users thanked this post: SiliconWizard

Offline emece67

  • Frequent Contributor
  • **
  • !
  • Posts: 614
  • Country: 00
Re: Reset - Sync, Async or None At All
« Reply #7 on: December 25, 2019, 08:31:20 pm »
.
« Last Edit: August 19, 2022, 02:43:12 pm by emece67 »
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3547
  • Country: ca
Re: Reset - Sync, Async or None At All
« Reply #8 on: December 27, 2019, 09:32:30 pm »
Xilinx has lots of stuff which must start in reset and then be released once the clock is stable - stuff like SERDES, FIFO etc. If you must you must.

Otherwise, I've never felt that I needed reset just for sake of having it. There are times when you need to put something, such as a state machine, in the initial state, but if you're going to put every flop into a known state, you will use lots of resources. And there's no benefit because typically most of the flops are "don't care". Usually, only resetting the state is sufficient.

I always try to do everything synchronous, as much as I can. This way, things are much more deterministic. As a bonus, regular FPGA resources can be used instead of dedicated RST pins.
 
The following users thanked this post: legacy

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: Reset - Sync, Async or None At All
« Reply #9 on: December 30, 2019, 11:31:52 pm »
I usually only have synchronous code, and my HDL simulator does explicitly need the reset signal to operate. Hence I leave it in the testbench and in the code with a macro to eventually disable it on synthesis.
 

Offline Someone

  • Super Contributor
  • ***
  • Posts: 6074
  • Country: au
    • send complaints here
Re: Reset - Sync, Async or None At All
« Reply #10 on: December 31, 2019, 02:38:22 am »
Xilinx has lots of stuff which must start in reset and then be released once the clock is stable - stuff like SERDES, FIFO etc. If you must you must.
But the classic pitfall is thinking of these as "resets" and making large global nets. It will need to be reset at some point before using the function, but there are likely many other processes/functions which will take some time to come up. A cascade or streaming reset that triggers each local part as required/possible is usually more appropriate and easily closes timing as a synchronous process.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->