Re: [myhdl-list] intbv return types
Brought to you by:
jandecaluwe
From: Jan D. <ja...@ja...> - 2009-04-19 08:08:59
|
Christopher L. Felton wrote: > Curiosity, what was the rational behind the mathematical operators for > the intbv object returning the integer values and the logic operators > (shifts, and, or, xor, etc) returning an intbv object? > > Example > a = intbv(1) > b = intbv(2) > > c = a + b > type(c) > <type 'int'> > > c = a ^ b > type(c) > <class 'myhdl._intbv.intbv'> If the return value is an intbv, you can slice and index it. This probably makes sense for "bit-oriented" operations, and perhaps less for "arithmetic" operations. Therefore, for the latter case it might be a good idea to avoid the overhead of intbv construction. This is all a little bit arbitrary and speculative - for example, I haven't done tests to check how significant the intbv construction overhead exactly is. We always have the option to change the return type to intbv if there's a real need. 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 |