Commit 79494313 authored by Quentin Aristote's avatar Quentin Aristote
Browse files

debuggin

parent 503e6969
......@@ -92,8 +92,8 @@ end where
(* a = 0 *)
ez<n>(a:[n]) = o where
if n = 0 then
o = 0
if n = 1 then
o = not(a[0])
else
o = not(a[0]) & ez<n-1>(a[1..])
end if
......@@ -153,26 +153,26 @@ end where
(* ------------------------------ INSTRUCTIONS ------------------------------ *)
addi(s:[16], imm:[16]) = o:[16] where
(o, c) = add<16>(imm, s, 0)
(o, c) = add<16>(s, imm, 0)
end where
bltz(s:[16], imm:[16], PC:[16]) = new_PC:[16] where
(new_PC, c) = add<16>(PC,
multi_mux<16>(lz<16>(s), imm, 0b0000000000000100),
multi_mux<16>(lz<16>(s), imm, 0b0000000000000001),
0)
end where
beq(s:[16], t:[16], imm:[16], PC:[16]) = new_PC:[16] where
e = sub<16>(s, t) ;
(new_PC, c) = add<16>(PC,
multi_mux<16>(ez<16>(e), imm, 0b0000000000000100),
multi_mux<16>(ez<16>(e), imm, 0b0000000000000001),
0)
end where
bne(s:[16], t:[16], imm:[16], PC:[16]) = new_PC:[16] where
e = sub<16>(s, t) ;
(new_PC, c) = add<16>(PC,
multi_mux<16>(ez<16>(e), 0b0000000000000100, imm),
multi_mux<16>(ez<16>(e), 0b0000000000000001, imm),
0)
end where
......@@ -188,7 +188,6 @@ type_i(opcode:[6],
t:[16],
imm:[16],
PC:[16]) = (write_enable,
write_address:[5],
write_value:[16],
new_PC:[16]) where
......@@ -203,7 +202,6 @@ type_i(opcode:[6],
(inc_PC, c) = add<16>(PC, 0b0000000000000001, 0) ;
write_enable = opcode[2] ;
write_address = multi_mux<5>(opcode[5], rs, rt) ;
write_value = multi_mux<16>(opcode[5], o_lui, o_addi) ;
new_PC = multi_mux<16>(opcode[2], inc_PC, new_PC_v2)
end where
......@@ -237,25 +235,26 @@ register_access(rs:[5],
t7:[16],
rs_val:[16],
rt_val:[16]) where
t0 = ram<4, 16>(0b1000, write_enable, write_address[1..], write_word) ;
t1 = ram<4, 16>(0b1001, write_enable, write_address[1..], write_word) ;
t2 = ram<4, 16>(0b1010, write_enable, write_address[1..], write_word) ;
t3 = ram<4, 16>(0b1011, write_enable, write_address[1..], write_word) ;
t4 = ram<4, 16>(0b1100, write_enable, write_address[1..], write_word) ;
t5 = ram<4, 16>(0b1101, write_enable, write_address[1..], write_word) ;
t6 = ram<4, 16>(0b1110, write_enable, write_address[1..], write_word) ;
t7 = ram<4, 16>(0b1111, write_enable, write_address[1..], write_word) ;
real_write_address = write_address[1..] ;
t0 = ram<4, 16>(0b1000, write_enable, real_write_address, write_word) ;
t1 = ram<4, 16>(0b1001, write_enable, real_write_address, write_word) ;
t2 = ram<4, 16>(0b1010, write_enable, real_write_address, write_word) ;
t3 = ram<4, 16>(0b1011, write_enable, real_write_address, write_word) ;
t4 = ram<4, 16>(0b1100, write_enable, real_write_address, write_word) ;
t5 = ram<4, 16>(0b1101, write_enable, real_write_address, write_word) ;
t6 = ram<4, 16>(0b1110, write_enable, real_write_address, write_word) ;
t7 = ram<4, 16>(0b1111, write_enable, real_write_address, write_word) ;
rs_val = multi_mux<16>(ez<5>(rs),
0b0000000000000000,
ram<4, 16>(rs[1..],
write_enable,
write_address[1..],
real_write_address,
write_word)) ;
rt_val = multi_mux<16>(ez<5>(rt),
0b0000000000000000,
ram<4, 16>(rt[1..],
write_enable,
write_address[1..],
real_write_address,
write_word)) ;
end where
......@@ -330,7 +329,6 @@ execute_command(command:[32], old_PC:[32]) = (t0:[16],
(* la valeur ajoutée à PC dans les branchements est divisée par 4 dans le
code assembleur compilé pour gagner 2 bits *)
(write_enable_I,
write_address_I,
write_value_I,
new_PC_I) = type_i(opcode,
rs, rs_val,
......@@ -345,7 +343,7 @@ execute_command(command:[32], old_PC:[32]) = (t0:[16],
I = opcode[2] + opcode[3] + opcode[5] ;
write_enable = mux(J, 0, mux(I, write_enable_I, 1)) ;
write_address = multi_mux<5>(I, write_address_I, rd) ;
write_address = multi_mux<5>(I, rt, rd) ;
write_value = multi_mux<16>(I, write_value_I, write_value_R) ;
(inc_PC, c) = add<32>(old_PC, 0b00000000000000000000000000000100, 0) ;
new_PC = multi_mux<32>(J + I,
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment