N
nickooooola
Hello to all
I'm about to write a simulator for a microcontroller in python
(why python? because I love it!!!)
but I have a problem.
The registry of this processor are all 8 bit long (and 10 bit for some
other strange register)
and I need to simulate the fixed point behaviour of the register,
and to access the single bit.
f.x. (this is a pseudo python session, only for understanding)
#or 1111111110, the memorization truncate the upper bits ( or perhaps
generate an exception?)0x00
# truncated again
# or True? Z flag indicated an overflow in arithmetic operations
Is possibile to do so in python?
thanks
I'm about to write a simulator for a microcontroller in python
(why python? because I love it!!!)
but I have a problem.
The registry of this processor are all 8 bit long (and 10 bit for some
other strange register)
and I need to simulate the fixed point behaviour of the register,
and to access the single bit.
f.x. (this is a pseudo python session, only for understanding)
0x7FEreg1 = fixed_int(8)
reg2 = fixed_int(10)
reg1[0].set() or
reg1[0] = 1 # or True? how to rapresent a binary bit
reg1[0] 1
reg1[1] 0
reg1[9]reg2 = 0x7FE # in binary 11111111110 , or 11 bit long
reg2
#or 1111111110, the memorization truncate the upper bits ( or perhaps
generate an exception?)0x00
# truncated again
1myprocessor.flags['z']
# or True? Z flag indicated an overflow in arithmetic operations
Is possibile to do so in python?
thanks