Re: [myhdl-list] len() of an intbv
Brought to you by:
jandecaluwe
From: Jan D. <ja...@ja...> - 2010-01-13 17:20:31
|
sv...@te... wrote: > Hi all, > > Is ther a particular reason why the number of bits (according to the len() finction is 1 in following example: > > a = intbv(0, min=0, max=1) > len(a) > --> returns 1 instead of an expected 0 > > I thought 'a' can only store '0' in this case, and you don't need any bits for doing that. > > b = intbv(0,min=0,max=2) > len(b) > --> returns 1 > > This is not so important at the moment for me, but it should be interesting to know where this (according to me) unlogical behavior comes from. intbv.len() returns the minimal bit width required to represent the possible values with traditional HDL bit vectors: unsigned for naturals, 2's complement signed for integers. intbv(0, min=0, max=1) would be mapped to unsigned'"0", with bit width 1. 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 |