mark.sea...@gmail.com wrote:

Python 2.5.3 for business reasons.

So I want a class ShadowRegister, which just has a value that I can do
get/set bit sel and slice ops.  I got that working with __init__.  It
was subclass from "object".  Then I wanted a RegisterClass that was a
subclass of ShadowRegister, which would read a hardware register
before doing get bit sel/slices, or read HW reg, do set bit sel/slice,
but when I try to print in hex format ('0x016X') it said it required
an int (but the ShadowRegister class had no issues).  Then I was told
instead of using object I could subclass as long (seemed the only
solution for Python 2.5).  Then when I started to want to add my own
init code (like register length in bits), I was told I should use
__new__ instead of __init__.  So but ever since then I've noticed that
my value is not changing from the initially set value.  I'm really
cornfused now.

In the past, someone referred you to the intbv class in MyHDL.
You mentioned that it does "more than you want".
However, it seems to me that what intbv really does, is to solve
the kind of issues that you are struggling with. Perhaps
you want to look at it again.

Jan

--
Jan Decaluwe - Resources bvba - http://www.jandecaluwe.com
   Python as an 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
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to