###########################################
# (C)Copyright by N.T.T 1993(unpublished) #
# All rights are reserved.                #
###########################################
sflread cpu.sfl
autoinstall top

#redirect simulation results into file
speak cpu.sim
#redirect simulation errors into file
#claim cpu.err

print "\n--- simulation modules:\n"
lmc
print "\n--- facilities of top module:\n"
lc

#-simulated code----------------------------
# 0x00 LDXI 0xfd
# 0x02 LDAX
# 0x03 CLC
# 0x04 LDXI 0xfe
# 0x06 ADCX
# 0x07 LDXI 0xff
# 0x09 STAX
# 0x0a SEC
# 0x0b BC 0x0b

#-Instruction memory------------------------
memset /ram/cell X00 \
0X83 0Xfd \
0X01 \
0X08 \
0X83 0Xfe \
0X0b \
0X83 0Xff \
0X02 \
0X07 \
0X8d 0X0b

#-Data memory-------------------------------
memset /ram/cell Xfd \
0X12 0X34 0X00

print "\n--- simulation start:\n"
print "\n"

print \
"input pins| internal state, signals                   | output pins, memory\n"
print  \
"CLK  start| pc a  x  c op1 op2 md if     exec  ift ext| adrs dti dto ff\n"
print \
"---------------------------------------------------------------------------\n"

rpt_add rpt1 \
"%2t   %B    | %2X %2X %2X %B %2X  %2X  %2X %6s %5s %B   %B  | %2X   %2X  %2X  %2X\n" \
cpu.start cpu/pc cpu/a cpu/x cpu/c cpu/op1 cpu/op2 cpu/md \
cpu/if cpu/exec cpu/if.ift cpu/exec.ext cpu.adrs cpu.dti cpu.dto \
ram/cell@Xff

sch_add 1 tag "set start 0B1"
report do
forward +26
