Re: [myhdl-list] " Error in user defined VHDL code" should show line, and column for erro
Brought to you by:
jandecaluwe
From: Jan D. <ja...@ja...> - 2010-07-03 11:32:51
|
Angel Ezquerra wrote: > Jan Decaluwe <jan <at> jandecaluwe.com> writes: > >> Error messages are often a weak point, but I thought that in the particular >> case of user-defined code, it was reasonable. I don't immediately understand >> what you describe here, a small example welcome. > > I got the following error message while trying to use a very long VHDL > user defined string on one of my myhdl python files: > > "raise ToVHDLError("Error in user defined VHDL code", msg, info) > myhdl.ToVHDLError: in file dsp48e.py, function dsp48e starting on line 3: > Error in user defined VHDL code: <type 'exceptions.ValueError'>: unsupported > format character ',' (0x2c) at index 6175" > > As you can see, the error indicates "index 6175" as the place where the > error happened. I assume that that refers to the 6175 character on the > __vhdl__ string. If that is the case, while it would actually be > possible to use that information to find where the error happened, > it is definitelly not very practical to do so! Instead it would be > much better if the error message told you that the error happened > on line 89, column 12 of the __vhdl__ string, or, even better, > on line 101, column 20 of the original python script. So you get the exact file, function, error condition, index in the string and even the offending character, and this is not good enough :-) Mm. When something is wrong with the format string evaluation, MyHDL forwards you whatever exception Python gives it. So this is pretty much what native python would tell you. There are a myriad things that can go wrong, and the error may be Python-version dependent. What you are asking is combining the MyHDL info with the specific Python info, which is probably unfeasible in practical terms. String errors are not normally reported in lines or columns. So for complex cases like this, I think it's not unreasonable to organize for easier debugging. For example, by putting the large template string in a separate file, and use an editor that can move to buffer positions (emacs has this natively). Or even to debug the string in Python separately from its use in MyHDL. Jan -- 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 Analog design automation: http://www.mephisto-da.com World-class digital design: http://www.easics.com |