Re: [myhdl-list] essay about integer arithmetic
Brought to you by:
jandecaluwe
From: Felton C. <chr...@gm...> - 2009-03-06 15:00:16
|
On Mar 6, 2009, at 8:26 AM, Michael Baxter wrote: > Yes, but I intend for integers to represent fields of bits, and to > do numerous > other things that are not constrained by intervals. In fact, some of > those > things (involving plural, concurrent bitfields) can be done purely > with > conventional arithmetic operations. Normal integers, but not being > used normally. I disagree, here we are specifically talking about integers constrained by intervals. Integer being used as integers. Particular to myhdl you can still simply define bit vector based on the number of bits. Using the constrained integer bit vectors, I would think of as a subset. And that it would be useful to design with integers, when intended to use integers, instead of dealing with a more basic type. I don't believe this is intended to force min, max for any and all bit vectors. I think the essay makes a good argument to use constrained integer bit vectors when the design is using integers. > > > A 32-bit microprocessor (comprised of hardware) can have 32-bit > registers that > represent integers that are not signed, or that are signed, both at > the same > time. It all depends on what software does to interpret the meaning > of those > 32-bit register bits. What's the correct interval representation for > the > design of the registers in that hardware? This is a great example, you have a generic container. Presumably you may not want to use an integer to represent it in its basic form. But from the perspective of different computation elements it could be desirable that the register is presented as a constrained integer. In the Verilog case it would be the same type, in VHDL example the register maybe a std_logic but the adder may deal with it as a signed type. Similar scenario in myhdl could occur. > > > Another case I neglected is also salient. In some very useful encoding > systems, collections of bits can also mean [-1,1] values, which has a > wonderful representation in bit-form, but not as integers, nor as > intervals. This is another good example, question constrained integer useful or not. Chris |