Re: [myhdl-list] intbv wrap
Brought to you by:
jandecaluwe
From: Christopher F. <chr...@gm...> - 2011-05-05 11:34:11
|
<snip> >>> >>> I can try to put together a real patch with tests this evening ... >>> can't promise it though. >> >> I will provide my latest patch tonight, I believe it should be finished, >> I am still working on the test cases. If you like you can review my >> patch and send suggestions. Jan D. published procedures for creating >> patches with Mercurial, http://www.myhdl.org/doku.php/dev:patches. > > I was not aware of the state of your patch. I thought this was only a > proof of concept. I'd be delighted to review it in its whole ! > Here is the latest I have put together. It has both the wrap and the public val property. Simple test case ----------------- from myhdl import * x = intbv(0, min=-8, max=8, wrap=True) x[:] = x + 1 assert x == 1 x[:] = x + 2 assert x == 3 x[:] = x + 5 assert x == -8 x[:] = x + 1 assert x == -7 x[:] = x - 5 assert x == 4 x[:] = x - 4 assert x == 0 x[:] = x - 1 assert x == -1 Chris |