Re: [myhdl-list] convertion of Conditional Expressions in python2.5 and up
Brought to you by:
jandecaluwe
|
From: Jan D. <ja...@ja...> - 2009-01-05 16:19:51
|
Jian LUO wrote:
> Hi Jan,
>
> I've made a patch for conversion of Conditional Expressions, e.g:
> x = true_value if condition else false_value
> which is new in python 2.5 (not quite new as 3.0 is out :) )
>
> This kind of expressions are widely used in both verilog and vhdl.
> I think it's worth to convert it as well, so I made the patch.(see
> attachment)
>
> And don't worry about the python2.4. Conditional expression will not
> pass the syntax check in python 2.4 before it fails. So there is no lose
> at all.
Thanks, good to see that someone can make sense of the conversion
source code :-)
I'm going to push this to MyHDL 0.7. There are a few other syntactic sugar
features that will be added in that version, and Python 2.5 can be
made a requirement. Also, a unit test has to be added.
In the future, may I suggest to use mercurial to make patches? The
whole process is described here:
http://www.myhdl.org/doku.php/dev:patches
Jan
--
Jan Decaluwe - Resources bvba - http://www.jandecaluwe.com
From Python to silicon:
http://www.myhdl.org
|