verilog like class w/ bitslicing & int/long classtype

2009-01-29 Thread mark . seagoe
I'm trying to make a script environment with datatypes (or classes) for accessing hardware registers. At the top level, I would like the ability to bitwise ops if bit slice brackets are used, but if no brackets are used, I would like it to write/read the whole value. For example, if I have someth

Re: verilog like class w/ bitslicing & int/long classtype

2009-01-29 Thread Stef Mientki
mark.sea...@gmail.com wrote: I'm trying to make a script environment with datatypes (or classes) for accessing hardware registers. At the top level, I would like the ability to bitwise ops if bit slice brackets are used, but if no brackets are used, I would like it to write/read the whole value.

Re: verilog like class w/ bitslicing & int/long classtype

2009-01-29 Thread John Machin
On Jan 30, 9:02 am, mark.sea...@gmail.com wrote: > I'm trying to make a script environment with datatypes (or classes) > for accessing hardware registers.  At the top level, I would like the > ability to bitwise ops if bit slice brackets are used, but if no > brackets are used, I would like it to w

Re: verilog like class w/ bitslicing & int/long classtype

2009-01-29 Thread John Machin
On Jan 30, 9:55 am, Stef Mientki wrote: >   def __repr__ ( self ) : >     line = hex ( self.Value ) >     line = line [:2] + line [2:].upper() >     return line > > btw, I'm a hardware guy too, and therefor I've never understood why the > hex function returns lowercase ;-) 0xFF?? *Real* hardware

Re: verilog like class w/ bitslicing & int/long classtype

2009-01-29 Thread mark . seagoe
Thanks. So far these solutions will return strings. So I can't really treat it like a variable, yet still perform bitslice on it, since I need a special class to do bitslice and bit selection, but as soon as I try to pass it into some other function to check a bit, I gotta then do another operati

Re: verilog like class w/ bitslicing & int/long classtype

2009-01-29 Thread Stef Mientki
mark.sea...@gmail.com wrote: Thanks. So far these solutions will return strings. So I can't really treat it like a variable, yet still perform bitslice on it, since I need a special class to do bitslice and bit selection, but as soon as I try to pass it into some other function to check a bit,

Re: verilog like class w/ bitslicing & int/long classtype

2009-01-29 Thread Stef Mientki
mark.sea...@gmail.com wrote: Thanks. So far these solutions will return strings. So I can't really treat it like a variable, yet still perform bitslice on it, since I need a special class to do bitslice and bit selection, but as soon as I try to pass it into some other function to check a bit,

Re: verilog like class w/ bitslicing & int/long classtype

2009-01-29 Thread mark . seagoe
On Jan 29, 3:13 pm, Stef Mientki wrote: > mark.sea...@gmail.com wrote: > > Thanks.  So far these solutions will return strings.  So I can't > > really treat it like a variable, yet still perform bitslice on it, > > since I need a special class to do bitslice and bit selection, but as > > soon as I

Re: verilog like class w/ bitslicing & int/long classtype

2009-01-29 Thread MRAB
John Machin wrote: On Jan 30, 9:02 am, mark.sea...@gmail.com wrote: I'm trying to make a script environment with datatypes (or classes) for accessing hardware registers. At the top level, I would like the ability to bitwise ops if bit slice brackets are used, but if no brackets are used, I woul

Re: verilog like class w/ bitslicing & int/long classtype

2009-01-29 Thread Jervis Whitley
On Fri, Jan 30, 2009 at 9:02 AM, wrote: > I'm trying to make a script environment with datatypes (or classes) > for accessing hardware registers. At the top level, I would like the > ability to bitwise ops if bit slice brackets are used, but if no > brackets are used, I would like it to write/re

Re: verilog like class w/ bitslicing & int/long classtype

2009-01-29 Thread mark . seagoe
On Jan 29, 3:13 pm, Stef Mientki wrote: > mark.sea...@gmail.com wrote: > > Thanks.  So far these solutions will return strings.  So I can't > > really treat it like a variable, yet still perform bitslice on it, > > since I need a special class to do bitslice and bit selection, but as > > soon as I

Re: verilog like class w/ bitslicing & int/long classtype

2009-01-29 Thread Marc 'BlackJack' Rintsch
On Fri, 30 Jan 2009 00:25:03 +0100, Stef Mientki wrote: > try this: > > class MyRegClass ( int ) : > def __init__ ( self, value ) : > self.Value = value > def __repr__ ( self ) : > line = hex ( self.Value ) > line = line [:2] + line [2:].upper() > return line def __repr__

Re: verilog like class w/ bitslicing & int/long classtype

2009-01-30 Thread Stef Mientki
Marc 'BlackJack' Rintsch wrote: On Fri, 30 Jan 2009 00:25:03 +0100, Stef Mientki wrote: try this: class MyRegClass ( int ) : def __init__ ( self, value ) : self.Value = value def __repr__ ( self ) : line = hex ( self.Value ) line = line [:2] + line [2:].upper() return li

Re: verilog like class w/ bitslicing & int/long classtype

2009-01-30 Thread rdmurray
Quoth Stef Mientki : > Marc 'BlackJack' Rintsch wrote: > > On Fri, 30 Jan 2009 00:25:03 +0100, Stef Mientki wrote: > > > > > >> try this: > >> > >> class MyRegClass ( int ) : > >> def __init__ ( self, value ) : > >> self.Value = value > >> def __repr__ ( self ) : > >> line = hex ( se

Re: verilog like class w/ bitslicing & int/long classtype

2009-01-31 Thread Marc 'BlackJack' Rintsch
On Fri, 30 Jan 2009 21:59:34 +0100, Stef Mientki wrote: > Marc 'BlackJack' Rintsch wrote: >> On Fri, 30 Jan 2009 00:25:03 +0100, Stef Mientki wrote: >> >> >>> try this: >>> >>> class MyRegClass ( int ) : >>> def __init__ ( self, value ) : >>> self.Value = value >>> def __repr__ ( self ) :