summaryrefslogtreecommitdiff
path: root/cpu/cpu.ml
diff options
context:
space:
mode:
authorAlex AUVOLAT <alex.auvolat@ens.fr>2014-01-07 15:51:01 +0100
committerAlex AUVOLAT <alex.auvolat@ens.fr>2014-01-07 15:51:01 +0100
commit176cc04414d44b9eebdc9627c99f9b6e5e92ba98 (patch)
tree1a3b2e736bb57e05efe43f7e308eaaca8b3e543b /cpu/cpu.ml
parentd9f8744ea219fb04057059cdcbf7162534c63852 (diff)
downloadSystDigit-Projet-176cc04414d44b9eebdc9627c99f9b6e5e92ba98.tar.gz
SystDigit-Projet-176cc04414d44b9eebdc9627c99f9b6e5e92ba98.zip
Document ; add hlt instruction ; make monitor faster.
Diffstat (limited to 'cpu/cpu.ml')
-rw-r--r--cpu/cpu.ml6
1 files changed, 6 insertions, 0 deletions
diff --git a/cpu/cpu.ml b/cpu/cpu.ml
index 94cc47c..b7e394b 100644
--- a/cpu/cpu.ml
+++ b/cpu/cpu.ml
@@ -203,6 +203,12 @@ let rl, rh, i, ex, exf, pc =
let wr = mux instr_lra wr (const "101") in
let rwd = mux instr_lra rwd (nadder 16 pc (sign_extend 11 16 i_jd)) in
+ (* instruction : hlt *)
+ let instr_hlt = exec ^& eq_c 5 i_i 0b01111 in
+ let halted, set_halted = loop 1 in
+ let halted = set_halted (instr_hlt ^| (reg 1 halted)) in
+ let exec_finished = mux halted exec_finished (const "0") in
+
(* instruction : lw/lwr/sw/swr *)
let instr_lsw = eq_c 4 (i_i % (1, 4)) 0b1000 in
let instr_lswr = eq_c 4 (i_i % (1, 4)) 0b1010 in