URL
https://opencores.org/ocsvn/a-z80/a-z80/trunk
[/] [a-z80/] [trunk/] [tools/] [dongle/] [neg/] [simulate-neg.py] - Diff between revs 3 and 8
Show entire file |
Details |
Blame |
View Log
Rev 3 |
Rev 8 |
Line 1... |
Line 1... |
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
#
|
#
|
# This script simulates 'neg' calculation and generates values for numbers 0-255.
|
# This script simulates 'neg' calculation and generates values for numbers 0-255.
|
# These can be compared with a real Z80 run values.
|
# These can be compared with a real Z80 run values.
|
#
|
#
|
import sys
|
import sys
|
Line 53... |
Line 53... |
vf = (carry_ins>>7)&1 # VF = Internal carry from bit [6] to [7]
|
vf = (carry_ins>>7)&1 # VF = Internal carry from bit [6] to [7]
|
vf ^= cf # XOR'ed with the final carry out
|
vf ^= cf # XOR'ed with the final carry out
|
|
|
flags = (sf<<7) | (zf<<6) | (yf<<5) | (hf<<4) | (xf<<3) | (vf<<2) | (nf<<1) | (cf<<0)
|
flags = (sf<<7) | (zf<<6) | (yf<<5) | (hf<<4) | (xf<<3) | (vf<<2) | (nf<<1) | (cf<<0)
|
|
|
print '%0.2X -> %0.2X Flags = %0.2X' % ( inA, finalA, flags)
|
print ('%0.2X -> %0.2X Flags = %0.2X' % ( inA, finalA, flags))
|
|
|
No newline at end of file
|
No newline at end of file
|
© copyright 1999-2025
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.