summaryrefslogtreecommitdiff
path: root/cpu
diff options
context:
space:
mode:
authorAlex AUVOLAT <alex.auvolat@ens.fr>2014-01-09 16:10:58 +0100
committerAlex AUVOLAT <alex.auvolat@ens.fr>2014-01-09 16:10:58 +0100
commit8d87eacbcb26e7abc429d7824e90c617f172045e (patch)
tree07cffa442f5170503a7148347b969c76435415c0 /cpu
parent35e0c0f16f58a7503045de5e047e029dd06983a2 (diff)
downloadSystDigit-Projet-8d87eacbcb26e7abc429d7824e90c617f172045e.tar.gz
SystDigit-Projet-8d87eacbcb26e7abc429d7824e90c617f172045e.zip
Make things great !
Diffstat (limited to 'cpu')
-rw-r--r--cpu/Makefile8
-rw-r--r--cpu/ROM_count_seconds.rom (renamed from cpu/prog_rom0.rom)0
-rw-r--r--cpu/os.asm25
-rw-r--r--cpu/prog_test1.rom43
4 files changed, 31 insertions, 45 deletions
diff --git a/cpu/Makefile b/cpu/Makefile
index 5efa691..7e92314 100644
--- a/cpu/Makefile
+++ b/cpu/Makefile
@@ -6,9 +6,13 @@ AUXILLARY=alu.ml
SCHED=../sched/sched
SIM=../csim/csim
MON=../monitor/mon
+ASM=../asm/asm
-all: _build/cpu_opt.dumb
- $(MON) $(SIM) -rom ROM0 prog_test1.rom $<
+all: _build/cpu_opt.dumb os.rom
+ $(MON) $(SIM) -rom ROM0 os.rom $<
+
+os.rom: os.asm
+ $(ASM) $< > $@
%.sim: _build/%.dumb
$(SIM) -n 12 $<
diff --git a/cpu/prog_rom0.rom b/cpu/ROM_count_seconds.rom
index 7330dac..7330dac 100644
--- a/cpu/prog_rom0.rom
+++ b/cpu/ROM_count_seconds.rom
diff --git a/cpu/os.asm b/cpu/os.asm
new file mode 100644
index 0000000..5d58ff7
--- /dev/null
+++ b/cpu/os.asm
@@ -0,0 +1,25 @@
+.text
+init:
+ li B _clock
+ lw B 0(B)
+ jz B init
+ add D D B
+ push D
+ li A msgtick
+ jal ser_out_msg
+ pop D
+ j init
+
+ser_out_msg:
+ li C _output
+ser_out_msg_loop:
+ lb B 0(A)
+ jz B ser_out_msg_ret
+ sb B 0(C)
+ incri A 1
+ j ser_out_msg_loop
+ser_out_msg_ret:
+ jr RA
+
+msgtick:
+ ascii "Tick!"
diff --git a/cpu/prog_test1.rom b/cpu/prog_test1.rom
deleted file mode 100644
index 8156628..0000000
--- a/cpu/prog_test1.rom
+++ /dev/null
@@ -1,43 +0,0 @@
-56 8
- # init:
-00000000 01010011 # lilz B 0
-00000010 01001011 # liu B 64
-00000010 01000001 # lw B 0(B)
-00000000 10110011 # lilz E init
-00000000 10101011 # liu E init
-01000010 10101010 # jer E B Z
-00010001 00100000 # add D D B
-01111111 11101100 # incri SP -2
-00000111 00110001 # sw D 0(SP)
-01001100 10010011 # lilz A msgtick
-00000000 10001011 # liu A msgtick
-00010000 00010010 # jal ser_out_msg
-00000111 00100001 # lw D 0(SP)
-01000000 11101100 # incri SP 2
-00100111 11100010 # j init
- # ser_out_msg:
-01000000 11010011 # lilz C 2
-10000010 11001011 # liu C 65
- # ser_out_msg_loop:
-00000100 01001001 # lb B 0(A)
-00001100 10110011 # lilz E ser_out_msg_ret
-00000000 10101011 # liu E ser_out_msg_ret
-01000010 10101010 # jer E B Z
-00000110 01011001 # sb B 0(C)
-10000000 10001100 # incri A 1
-00101111 11100010 # j ser_out_msg_loop
- # ser_out_msg_ret:
-00000000 01101010 # jr RA
- # msgtick:
-00101010
- # msgtick:
-10010110
- # msgtick:
-11000110
- # msgtick:
-11010110
- # msgtick:
-10000100
- # msgtick:
-00000000
-