Capturing a UART Design in MyHDL and Testing It in an FPGA
eetimes.com
eetimes.com
Honestly I wonder if all these "open source HDLs aimed at hackers" projects are simply trying to do too much and what the world really needs is just a cleaner Verilog with the synthesis and simulation environments more strictly separated...
Also: what editor thought that the best way to represent code examples was as an unreadably small app screenshot followed by helpful "bigger image" and (sigh) "view this code on github" links?
VHDL is a little better but the syntax is horribly verbose and it lacks power to do advanced verification (either it needs a better library or it needs a few more features). In my mind VHDL can be saved, some VHDL-coffeescript could be wonderful.
MyHdl is interesting, it's build with clear goals & it's made by an experienced HW engineer that also understands good software design (most don't). He would disagree with you about simulation (http://www.jandecaluwe.com/blog/its-a-simulation-language.ht...). The RTL code that MyHdl generates always looked very clean to me and the simulation possibilities with python are of course infinitely better than anything that systemverilog or vhdl can offer.
The possibility to mix RTL and high level software is a very nice feature, for exemple: To make a FFT in Python in few lines and compare the output to your RTL FFT with asserts. And script it so you can loop through a different number of fixed bits width and check the TVE at each bit width.
To do this in Python I used ~50 lines, in VHDL it would be a headache and I probably would end up needing to use matlab to compare the results.
I think the problems I had is sort of the converse: hardware is hard. Reasoning about hardware is hard. And having the representation of your hardware about which you much reason be expressed in the actions of an interpreted program (where the synthesis is a side effect basically) makes things harder than it has to be. The RTL ends up being polluted with simulation constructs and hiding the meaning I'm trying to see. And if anything MyHDL is actually worse at this than Verilog or VHDL.
A good designer can avoid constructs that can't be or are very hard to simulate correctly. A good example is signals that have to cross clock domains, metastability is easily missed in simulation and the problems it causes in actual hardware are huge. Good hardware design tries to avoid or encapsulate these kind of constructs.
Beyond this you still have to deal with the analogue world and that is often hard to simulate. Clock generators that misbehave, working with memory controllers (and buggy IP cores): it's not all under your control and that why hardware design often feels so hard. A lot of time is spend on these issues, but that's only because the rest is made easy by using VHDL.
http://log.fundamental-code.com/2011/06/11/vhdl-code-generat... http://github.com/fundamental/modv
I don't have enough experience in the other HDL options out there to really say anything conclusive other than the space is a bit of a mess as a whole.
I haven't looked a chisel yet (scala is my favorite software programming language though).
I don't doubt the usefulness of a subset of systemverilog, but as a language it's very badly designed.
Real uarts tend to implement FIFOs and oversample and do control signals. The virtual 16550 linked below oversamples at 16x and the generic verilog uart below does at least try to sniff at the center of the bit clock even if I don't think it oversamples.
Here's a generic verilog uart
http://opencores.org/project,osdvu
here's a virtual 16550
http://opencores.org/project,uart16550
Those projects would be logical paths of inspiration to extend the python uart. You could probably just steal/borrow the PDF spec sheet for the virtual 16550 and use that as a spec to implement the python uart.