63 points · by Immortalin · 8y ago · 27 comments
And it seems to be the case for this one too. I quickly generated some Verilog code from one of the given examples and I was surprised to see flip-flops without reset. Also, not all registers are even being reset'ed at all.
I have some serious doubts about the quality of the hardware generated by this tool.
However, if it targets FPGA, and not ASICs, maybe the reset omission is on purpose. FPGA guarantees initialization on load and the some registers may not need to be cleared after usage. On the other hand, a reset signal consumes precious routing resources spanning large areas.
But I surely would triple-check this, even for FPGA use. I expect to actually do so in a few weeks.
EDIT: Ok, this comment sit far too long in the edit box before posting. Now I see the huge discussion in this thread. I'll keep this comment anyway.
Ken Chapman at Xilinx wrote some wonderful whitepapers about that; look them up. Join us in enlightenment, brother.
You mentioned those papers but you didn't link them, so I will have to guess that this is the one in order to address your comment:
- https://www.xilinx.com/support/documentation/white_papers/wp...
I guess the keyword here is "FPGA design". The author of the paper argues that the FPGA already offers an abstraction layer that allows the designer to ignore the problem for certain occasions in order to save up on area.
> The good news is that 99.99% of the time, the timing of the reset release really doesn't matter. (...) However, if you have ever had one of the circuits that doesn’t work the first time, then maybe you have encountered one of the 0.01% cases and have been unlucky enough to have released the reset at the wrong time.
> A design implemented in a Xilinx FPGA does not require insertion of a global reset network. For the vast majority of any design, the initialization state of all flip-flops and RAM following configuration is more comprehensive than any logical reset will ever be. There is no requirement to insert a reset for simulation because nothing will be undefined.
But it doesn't mean it is 100% correct as this design would be very poor if it was ever translated to an ASIC. I guess since this project is done with FPGA design in mind, the strict ASIC design rules don't apply here.
Not to mention that the coding style of a always@ block might influence certain optimizations in the hardware synthesis tool. If the FF is not explicit in the code, the tool might infer a latch instead, for example.
It's true that there are reasons to use use always@ blocks like the generated code provides but it's not really obvious in this case why it is being used.
Using async resets isn't a great example when many modern ASIC flows shun it in favor of synchronous resets. :-)
(Among other reasons, async reset will always mess up your design when you have crosstalk induced glitches; a sync reset will only do so when it coincides with a clock edge.)
> Not to mention that the coding style of a always@ block might influence certain optimizations in the hardware synthesis tool. If the FF is not explicit in the code, the tool might infer a latch instead, for example.
Yeah, let's just strongly disagree on that one and leave it at that.
I wonder how the results compare to something like TCE http://tce.cs.tut.fi/ which takes advantage of the LLVM ecosystem.
Given the lack even of advanced c-compiler optimizations and the inherent drawbacks of FPGAs, can this even beat the power or speed performance of a software implementation running on e.g. a modern ARM core?
I'm guessing that the RISC core gets optimized by dropping instructions that aren't needed for a particular C program.
But does it have some kind of heuristic to determine whether or not to drop an instructions based on how often it's used? Or is it just a greedy "If the C compiler generates instruction A, then add instruction A to the CPU" decision?
"Behind the scenes, Chips uses some novel techniques to generate compact and efficient logic - a hybrid of software and hardware.
Not only does the compiler translate the C code into CPU instructions, it also generates a customised pipelined RISC CPU on the fly. The CPU provides the optimal instruction set for any particular C program."
I'll test it out soon and post about it.
However, I would not raise my expectations that much.
Not sure how FPGAs do their thing but a swapping out fgets() with something else and setting up the garbage collector to use one block of memory would probably be necessary I'd imagine.