mirror of
https://github.com/rzzzwilson/pymlac.git
synced 2025-06-10 09:32:41 +00:00
Got combined PtrPtp device working
This commit is contained in:
parent
2bcbab9028
commit
dfeac3b1d4
@ -1,5 +1,8 @@
|
||||
# check multiple assemblerinstructions in DSL
|
||||
setmem 0100 [LAW 1|HLT]; setreg pc 0100; RUNUNTIL 0102; checkcycles 2; checkreg pc 0102; checkreg ac 1
|
||||
|
||||
# LAW
|
||||
setreg ac 0177777; setreg l 1; setmem 0100 [LAW 0]; setreg pc 0100; RUN;
|
||||
setreg ac 0177777; setreg l 1; setmem 0100 [LAW 0]; setreg pc 0100; RUN
|
||||
checkcycles 1; checkreg pc 0101; checkreg ac 0
|
||||
setreg ac 0177777; setreg l 0; setmem 0100 [LAW 0]; setreg pc 0100; RUN; checkcycles 1; checkreg pc 0101; checkreg ac 0
|
||||
setreg ac 0; setreg l 1; setmem 0100 [LAW 0377]; setreg pc 0100; RUN; checkcycles 1; checkreg pc 0101; checkreg ac 0377
|
||||
@ -377,17 +380,27 @@ setreg l 1; setmem 0100 [LSN]; setreg pc 0100; RUN; checkcycles 1; checkreg pc 0
|
||||
# SSF
|
||||
# SSN
|
||||
# HSF
|
||||
setreg ac 0; setreg pc 0100; mount ptr test.ptr;
|
||||
setmem 0100 [HON|HSF|JMP 0101|LAW 0|HRB|NOP|HSN|JMP 0106|JMP 0101];
|
||||
setreg ac 0; setreg pc 0100; mount ptr test.ptr
|
||||
setmem 0100 [HON|HSF|JMP 0101|LAW 0|HRB|NOP|HSN|JMP 0106|JMP 0101]
|
||||
rununtil 0105; checkreg ac 0; checkreg pc 0105
|
||||
rununtil 0105; checkreg ac 1; checkreg pc 0105
|
||||
rununtil 0105; checkreg ac 2; checkreg pc 0105;
|
||||
rununtil 0105; checkreg ac 2; checkreg pc 0105
|
||||
rununtil 0105; checkreg ac 3; checkreg pc 0105
|
||||
rununtil 0105; checkreg ac 4; checkreg pc 0105
|
||||
rununtil 0105; checkreg ac 5; checkreg pc 0105
|
||||
rununtil 0105; checkreg ac 6; checkreg pc 0105
|
||||
rununtil 0105; checkreg ac 7; checkreg pc 0105
|
||||
# HSN
|
||||
setreg ac 0; setreg pc 0100; mount ptr test.ptr;
|
||||
setmem 0100 [HON|HSF|JMP 0101|LAW 0|HRB|NOP|HSN|JMP 0106|JMP 0101];
|
||||
setreg ac 0; setreg pc 0100; mount ptr test.ptr
|
||||
setmem 0100 [HON|HSF|JMP 0101|LAW 0|HRB|NOP|HSN|JMP 0106|JMP 0101]
|
||||
rununtil 0105; checkreg ac 0; checkreg pc 0105
|
||||
rununtil 0105; checkreg ac 1; checkreg pc 0105
|
||||
rununtil 0105; checkreg ac 2; checkreg pc 0105;
|
||||
rununtil 0105; checkreg ac 2; checkreg pc 0105
|
||||
rununtil 0105; checkreg ac 3; checkreg pc 0105
|
||||
rununtil 0105; checkreg ac 4; checkreg pc 0105
|
||||
rununtil 0105; checkreg ac 5; checkreg pc 0105
|
||||
rununtil 0105; checkreg ac 6; checkreg pc 0105
|
||||
rununtil 0105; checkreg ac 7; checkreg pc 0105
|
||||
#
|
||||
# DLA
|
||||
# CTB
|
||||
@ -402,17 +415,18 @@ setreg ac 0; setreg pc 0100; mount ptr test.ptr;
|
||||
# TCF
|
||||
# TPC
|
||||
# HRB
|
||||
# HSF
|
||||
setreg ac 0; setreg pc 0100; mount ptr test.ptr;
|
||||
setmem 0100 [HON|HSF|JMP 0101|LAW 0|HRB|NOP|HSN|JMP 0106|JMP 0101];
|
||||
rununtil 0105; checkreg ac 0; checkreg pc 0105
|
||||
rununtil 0105; checkreg ac 1; checkreg pc 0105
|
||||
rununtil 0105; checkreg ac 2; checkreg pc 0105;
|
||||
rununtil 0105; checkreg ac 3; checkreg pc 0105;
|
||||
rununtil 0105; checkreg ac 4; checkreg pc 0105;
|
||||
rununtil 0105; checkreg ac 5; checkreg pc 0105;
|
||||
rununtil 0105; checkreg ac 6; checkreg pc 0105;
|
||||
rununtil 0105; checkreg ac 7; checkreg pc 0105;
|
||||
# HSF - read 7 bytes (values 0 to 7) from PTR file 'test.ptr'
|
||||
setreg ac 0; setreg pc 0100; mount ptr test.ptr
|
||||
setmem 0100 [HON|HSF|JMP 0101|LAW 0|HRB|NOP|HSN|JMP 0106|JMP 0101]
|
||||
rununtil 0105; checkreg ac 0
|
||||
rununtil 0105; checkreg ac 1
|
||||
rununtil 0105; checkreg ac 2
|
||||
rununtil 0105; checkreg ac 3
|
||||
rununtil 0105; checkreg ac 4
|
||||
rununtil 0105; checkreg ac 5
|
||||
rununtil 0105; checkreg ac 6
|
||||
rununtil 0105; checkreg ac 7
|
||||
checkreg pc 0105
|
||||
# HOF
|
||||
# HON
|
||||
# STB
|
||||
@ -420,18 +434,15 @@ setreg ac 0; setreg pc 0100; mount ptr test.ptr;
|
||||
# IOS
|
||||
# PSF
|
||||
# PPC
|
||||
setreg ac 0; setreg pc 0100; mount ptp test.ptp;
|
||||
setmem 0100 [LAW 0|PSF|JMP 0101|PPC|IAC|JMP 0101];
|
||||
rununtil 0104; checkreg ac 0;
|
||||
rununtil 0104; checkreg ac 1;
|
||||
setreg ac 0; setreg pc 0100; mount ptp test.ptp
|
||||
setmem 0100 [LAW 0|PSF|JMP 0101|PPC|IAC|JMP 0101]
|
||||
rununtil 0104; checkreg ac 0
|
||||
rununtil 0104; checkreg ac 1
|
||||
rununtil 0104; checkreg ac 2; checkreg pc 0104
|
||||
checkfile test.ptp test.ptr
|
||||
setreg pc 0100; mount ptp test.ptp;
|
||||
checkfile test.ptp
|
||||
setreg pc 0100; mount ptp test.ptp
|
||||
setmem 0100 [LWC 10|DAC 1|LAW 0|PSF|JMP 0103|PPC|IAC|ISZ 1|JMP 0103|HLT]
|
||||
rununtil 0111; checkreg ac 013; checkreg pc 0111
|
||||
checkfile test.ptp test.ptr
|
||||
checkfile test.ptp
|
||||
# and lots of IOT instructions
|
||||
|
||||
# check multiple assemblerinstructions in DSL
|
||||
setmem 0100 [LAW 1|HLT]; setreg pc 0100; RUNUNTIL 0102; checkcycles 2; checkreg pc 0102; checkreg ac 1
|
||||
|
||||
|
||||
@ -3,12 +3,10 @@
|
||||
# And run the test files.
|
||||
#
|
||||
|
||||
test: test.ptr
|
||||
rm -f test.ptp CPU.test.trace test_CPU.log
|
||||
python test_CPU.py CPU.test
|
||||
|
||||
test.ptr:
|
||||
test:
|
||||
rm -f test.ptr test.ptp CPU.test.trace test_CPU.log
|
||||
./make_ptr > test.ptr
|
||||
python test_CPU.py CPU.test
|
||||
|
||||
%: %.ptp
|
||||
./pymlac -b ptr -ptr $< -r 040 -t 0100 -r 0100
|
||||
|
||||
@ -206,7 +206,7 @@ class PtrPtp(object):
|
||||
|
||||
self.device_ready = False
|
||||
self.device_cycle_count = self.PtpNotReadyCycles
|
||||
self.device_open_file.write(value)
|
||||
self.device_open_file.write(chr(value))
|
||||
|
||||
def ptp_tick(self, cycles):
|
||||
"""Called to push PTP state along.
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
#
|
||||
# Make a PTR test file
|
||||
# 3 bytes: 0 1 2
|
||||
# 8 bytes: 0 1 2 3 4 5 6 7
|
||||
#
|
||||
|
||||
echo -n -e "\00\01\02"
|
||||
echo -n -e "\00\01\02\03\04\05\06\07"
|
||||
|
||||
@ -69,19 +69,20 @@ class TestCPU(object):
|
||||
|
||||
return result
|
||||
|
||||
def str2int(self, string):
|
||||
def str2int(self, s):
|
||||
"""Convert string to numeric value.
|
||||
|
||||
string numeric string (decimal or octal)
|
||||
s numeric string (decimal or octal)
|
||||
|
||||
Returns the numeric value.
|
||||
"""
|
||||
|
||||
base = 10
|
||||
if s[0] == '0':
|
||||
base = 8
|
||||
|
||||
try:
|
||||
if string[0] == '0':
|
||||
value = int(string, base=8)
|
||||
else:
|
||||
value = int(string)
|
||||
value = int(s, base=base)
|
||||
except:
|
||||
return None
|
||||
|
||||
@ -256,8 +257,9 @@ class TestCPU(object):
|
||||
|
||||
address address at which to stop
|
||||
|
||||
We allow PC to be stop address first instruction.
|
||||
We stop after that if PC == address.
|
||||
We must handle the case where PC initial address is the actual stop
|
||||
address, that is, execute one instruction before checking for the
|
||||
stop address.
|
||||
"""
|
||||
|
||||
new_address = self.str2int(address)
|
||||
@ -487,8 +489,8 @@ class TestCPU(object):
|
||||
# set globals
|
||||
self.reg_values = {}
|
||||
self.mem_values = {}
|
||||
self.reg_all_value = 0
|
||||
self.mem_all_value = 0
|
||||
self.reg_all_value = '0'
|
||||
self.mem_all_value = '0'
|
||||
|
||||
result = []
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user