Thread: [myhdl-list] MyHDL hierarchy extraction and conversion process is broken
Brought to you by:
jandecaluwe
From: Alexander H. <ale...@gm...> - 2014-01-28 11:25:07
|
Hey guys Sorry for the sensational subject. I do not really have the expertise to really throw out such a statement. But I programmed quite a bit in MyHDL now, and I _LOVE_ the approach. Using python as a HDL seems pretty natural and great to achieve more flexibility. Also writing of tests seems a lot more painless to me. However, as often as I was happy about the great features MyHDL offers, I am getting frustrated by completely misguiding error messages for an unknown reason, where the only possible way to fix them is spending many hours debugging through the MyHDL source code and finding the relevant part which generates the exception. But even when I got there, it is very difficult to find out how the MyHDL conversion process got to this point and which line in my sourcecode is relevant. One example I recently tried to program was a flexible serial receiver/transmitter, which takes a variable amount of 16-bit arguments and transmits them on request using Xilinx's uart core. In python I declared this module as def communicator(rx, tx, ... , clk, *data) However, this didn't work. I digged through the MyHDL conversion process and let me say, even as a Python expert it is really painful :-D MyHDL uses a large mix of profiling, static code inspection and runtime function inspection to determine the contained generators and used signals. Due to this the conversion process jumps around endlessly in the code, and precisely due to this mix (especially of static source code inspection and the dynamic one) it is impossible to use the great features which Python offers in terms of flexibility (dynamic numbers of arguments until the conversion process starts, code reuse by using classes, ...). Or at least it is not possible with my deepness of understanding of MyHDL. I know, this is some pretty blurry and not very constructive critics, but my intuition tells me that there should be a lot more consistent way of doing the conversion (ideally, only based on runtime inspection) which allows such ways of programming increasing the usefulness of MyHDL a lot. Even if it needs some additional function call in each module to register signals or generators to the converter. In the hope I didn't insult anyone and I didn't reveal myself as a complete moron because I forgot a simple MyHDL key concept, please tell me your opinions or what I could do better? Unfortunately I currently have another project which needs some progress, so I can't commit a lot work to commiting code to MyHDL, but I really want to see this project going to the next level :-) Best, Alex |
From: Jan C. <jen...@mu...> - 2014-01-28 11:53:24
|
On 28/01/14 11:24, Alexander Hungenberg wrote: > Hey guys . . . Thanks for the illuminating comments. I'd noticed that conversion is complex, and sometimes error messages don't help me so much. That is why I am determined to test more fully, and check conversion as early and frequently as possible, so that I can guess what it is I am breaking! Python and MyHDL are amazing, but do remind of the old saying: "Any sufficiently advanced form of technology is indistinguishable from magic " Jan Coombs. |
From: Jan D. <ja...@ja...> - 2014-01-30 17:47:47
|
On 01/28/2014 12:24 PM, Alexander Hungenberg wrote: > Hey guys > > Sorry for the sensational subject. I do not really have the expertise > to really throw out such a statement. Then why do you make it? -- Jan Decaluwe - Resources bvba - http://www.jandecaluwe.com Python as a HDL: http://www.myhdl.org VHDL development, the modern way: http://www.sigasi.com World-class digital design: http://www.easics.com |
From: Christopher F. <chr...@gm...> - 2014-01-30 21:37:09
|
On 1/28/2014 5:24 AM, Alexander Hungenberg wrote: > Hey guys > > Sorry for the sensational subject. I do not really have the expertise > to really throw out such a statement. I believe you will receive a better reception if you have a specific example (better yet a unit test) that demonstrates the problem and a subject title asking for assistance instead of declaring something not working without much evidence to support the claim. > But I programmed quite a bit in > MyHDL now, and I _LOVE_ the approach. Using python as a HDL seems > pretty natural and great to achieve more flexibility. Also writing of > tests seems a lot more painless to me. > That is great to hear. > However, as often as I was happy about the great features MyHDL > offers, I am getting frustrated by completely misguiding error > messages for an unknown reason, where the only possible way to fix > them is spending many hours debugging through the MyHDL source code > and finding the relevant part which generates the exception. But even > when I got there, it is very difficult to find out how the MyHDL > conversion process got to this point and which line in my sourcecode > is relevant. The best and most productive way to debug a module is to have a test for the module. I am not aware of many (any?) cases when someone had a test and proved the functionality, that conversion was much of an issue. > > One example I recently tried to program was a flexible serial > receiver/transmitter, which takes a variable amount of 16-bit > arguments and transmits them on request using Xilinx's uart core. In > python I declared this module as > > def communicator(rx, tx, ... , clk, *data) > > However, this didn't work. I digged through the MyHDL conversion > process and let me say, even as a Python expert it is really painful > :-D > Posting the error (or a chunk of it) or a sandbox example of a similar error to this mailing-list, you will get some useful help. > MyHDL uses a large mix of profiling, static code inspection and > runtime function inspection to determine the contained generators and > used signals. Due to this the conversion process jumps around > endlessly in the code, and precisely due to this mix (especially of > static source code inspection and the dynamic one) it is impossible to > use the great features which Python offers in terms of flexibility > (dynamic numbers of arguments until the conversion process starts, > code reuse by using classes, ...). Or at least it is not possible with > my deepness of understanding of MyHDL. > > I know, this is some pretty blurry and not very constructive critics, > but my intuition tells me that there should be a lot more consistent > way of doing the conversion (ideally, only based on runtime > inspection) which allows such ways of programming increasing the > usefulness of MyHDL a lot. Even if it needs some additional function > call in each module to register signals or generators to the > converter. The error messages are ever evolving and improving but the converter is not a compiler and the information from the converter might always be less than one might hope. As noted, if tested this usually is not an issue. Regards, Chris |
From: Jan C. <jen...@mu...> - 2014-02-07 16:21:31
|
On 28/01/14 11:24, Alexander Hungenberg wrote: > Hey guys . . . > However, as often as I was happy about the great features MyHDL > offers, I am getting frustrated by completely misguiding error > messages for an unknown reason, where the only possible way to fix > them is spending many hours debugging through the MyHDL source code > and finding the relevant part which generates the exception. But even > when I got there, it is very difficult to find out how the MyHDL > conversion process got to this point and which line in my sourcecode > is relevant. I lost my project yesterday, about nine files 1100 locs. Had a quick look round, and tried to find out what I'd done, then gave up. After restoring two files from last backup the test and conversion was running again. The file I most suspected turned out to be clean. So I looked into the other one. It took about an hour to restore the last sessions edits, running test & convert between each incremental reversion. At the end, it was a silly typo, so I am now back on course. Although sometimes my errors are unrecoverable (for me), I have noticed that the MyHDL errors are becoming more understandable. Or, it could be partly me, as I am also being much more careful, and can now see that the error messages cover more complex errors better, but really stupid dyslexic typo errors just seem to trash my code base. Last week, out of idle curiosity I chucked the verilog into the chip tools. I now have a pretty floor plan to hang on the wall. Keep at it! The first linux I used, and the first linux mobile I had, both would look like junk today, but they were the stepping stones towards the professional and friendly systems I use today. Jan Coombs. |