Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Quentin Aristote
Microprocessor
Commits
e6b8cde8
Commit
e6b8cde8
authored
Jan 23, 2019
by
Quentin Aristote
Browse files
corrected addressing
parent
8eaa7596
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
microprocesseur.mj
View file @
e6b8cde8
(* --------------------------- VARIABLES GLOBALES --------------------------- *)
const ops_nbr_length =
9
(* devrait suffire jusqu'à
256
lignes d'assembleur ;
const ops_nbr_length =
7
(* devrait suffire jusqu'à
128
lignes d'assembleur ;
est aussi la longueur du nombre d'opérations par
seconde *)
...
...
@@ -72,7 +72,7 @@ end where
add<n>(a:[n], b:[n], c_in) = (o:[n], c_out) where
if n = 0 then
o = [] ;
c_out =
0
c_out =
c_in
else
(tail, c) = add<n-1>(a[1..], b[1..], c_in) ;
tmp = a[0] ^ b[0] ;
...
...
@@ -176,10 +176,8 @@ bne(s:[16], t:[16], imm:[16], PC:[16]) = new_PC:[16] where
end where
j(label:[26], PC:[32]) = new_PC:[32] where
(* le compilateur assembleur rajoute 0x00400024 par défaut
normalement on devrait enlever 0x00400024 mais ça enlève
1 en trop *)
new_PC = sub<32>(PC[0..3].label.00, 0x00400023)
(* le compilateur assembleur rajoute 0x00400024 par défaut *)
new_PC = sub<32>(PC[0..3].label.00, 0x00400024)
end where
type_i(opcode:[6],
...
...
@@ -265,13 +263,13 @@ PC_access(new_PC:[32]) = old_PC:[32] where
end where
ops_to_do() = o:[ops_nbr_length] where
o = 0b
0
1100100
0
(* 100 *)
o = 0b1100100 (* 100 *)
end where
ops_done() = ops:[ops_nbr_length] where
(ops, c) = add<ops_nbr_length>(ram<1, ops_nbr_length>(0, 1, 0, ops),
0b0000000
01
,
0
)
0b0000000,
1
)
end where
(* -------------------------- PROGRAMME PRINCIPAL -------------------------- *)
...
...
@@ -351,10 +349,7 @@ main() = (t0:[16],
t4:[16],
t5:[16],
t6:[16],
t7:[16],
PC:[32],
command:[32],
ops:[ops_nbr_length]) where
t7:[16]) where
ops = ops_done () ;
reset = lz<ops_nbr_length>(sub<ops_nbr_length>(ops_to_do(), ops)) ;
PC = PC_access(multi_mux<32>(reset,
...
...
microprocesseur.net
View file @
e6b8cde8
This diff is collapsed.
Click to expand it.
netlist-simulator/main.ml
View file @
e6b8cde8
...
...
@@ -247,7 +247,7 @@ let compile filename =
Format
.
printf
"loading rom ...@."
;
let
file
=
(* Tries to open <id>.rom *)
try
open_in_bin
"/home/qaristote/documents/DI/SystèmeDigital/microprocesseur/command.rom"
(*
(!rom_directory ^ id ^ ".rom")
*)
open_in_bin
(
!
rom_directory
^
id
^
".rom"
)
with
|
Sys_error
s
when
(
s
=
!
rom_directory
^
id
^
...
...
@@ -390,14 +390,14 @@ let compile filename =
List
.
iter
(
fun
id
->
try
let
value
=
Env
.
find
id
!
env
in
Format
.
printf
"=> %s = %a -> 0x%x@."
id
print_value
value
Format
.
printf
"=> %s = %d@
\n
"
id
(
eval_addr
!
env
(
Aconst
value
))
with
|
Not_found
->
Format
.
eprintf
"Outbound output variable %s.@."
id
;
exit
2
)
p
.
p_outputs
;
p
.
p_outputs
;
Format
.
printf
"@."
;
(* --- Update --- *)
let
end_time
=
Unix
.
time
()
in
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment