Hi, 

On Thursday, December 29, 2011 12:19:43 PM Péteut, Alain (SPACE) wrote:
> I trying to code a VHDL backend for migen, it's still considered broken for
> now. Anyway if you'd like to have a look at it:
> https://github.com/peteut/migen/blob/vhdl/migen/fhdl/vhdl.py

A few comments:
* I would prefer the generated code to be self-contained, if possible. So you 
should get rid of the pkg_migen package (which should be easy enough given its 
current contents).
* Do not redefine the Constant and Value operator methods. Some of the rest of 
the code (e.g. optree) calls the _Operator constructor directly, and would not 
play nice with the VHDL back-end. Instead, translate the operator name when 
you see a _Operator class, and do not use str() on Constant classes but your 
own function.
* The VHDL shift operators are broken and should not be used. Use the 
functions instead (shift_left/shift_right).
* This is merely a personal preference, but I try to ignore most of VHDL's 
pesky type system by systematically declaring all my signals as 
std_logic_vector and using statements like:
r <= std_logic_vector(to_unsigned(a) + to_unsigned(b));
when I need arithmetic. They are ugly of course, but they're a lesser evil 
compared to what VHDL makes you do and think about when you crawl through all 
the details of the type conversion rules.

S.
_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode

Reply via email to