|
From: Stephen W. <st...@ic...> - 2008-04-22 17:30:03
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Cary R. wrote: | It appears that the writemem* problems are created by the 1<<(6-count). It look like the 1 is being interpreted as a two bit wide value instead of the normal integer 32 bits. This means that for values of count less than five the result is zero. The following simple program is producing incorrect results: | | module main; | reg [2:0] val; | | initial begin | for (val=0; val<=6; val=val+1) begin | $displayh(val,, 1<<(6-val)); | end | end | endmodule Hmm, ideally, I would like the left shift in a self-determined context like this to take on the size of the largest possible value that it can emit, but I think that can lead to crazyness. For example, if val were an integer (32bits) then the width of the shift expression would be 2**32. NAK! So I'm thinking that for left shift, if the left side is an unsized constant and the right side is non-consant, then it should take on the size of the integer. If both sides are constant, then it should take on exactly the right size. Does that sound workable to you? - -- Steve Williams "The woods are lovely, dark and deep. steve at icarus.com But I have promises to keep, http://www.icarus.com and lines to code before I sleep, http://www.picturel.com And lines to code before I sleep." -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4-svn0 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFIDiCgrPt1Sc2b3ikRAptZAJ43AjMaVsHynLfvAQ0O+q+Q0TAfQgCeLax4 c/zH3+a7fATvkUnJJxF3gPk= =mDP2 -----END PGP SIGNATURE----- |