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
503e6969
Commit
503e6969
authored
Jan 23, 2019
by
Quentin Aristote
Browse files
debugging
parent
95cbeb04
Changes
1
Hide whitespace changes
Inline
Side-by-side
netlist-simulator/main.ml
View file @
503e6969
...
...
@@ -239,6 +239,7 @@ let number_steps = ref (-1)
let
memory_directory
=
ref
"./"
let
frequence
=
ref
0
let
default
=
[
|
0
;
0
;
0
;
1
;
1
;
0
;
0
;
0
|
]
let
debug
=
ref
false
(* The main part of the program *)
let
compile
filename
=
...
...
@@ -325,10 +326,11 @@ let compile filename =
ram_size
(
fun
i
->
Array
.
make
word_size
false
)
in
(* only for the clock, useless elsewhere *)
(* only for the clock, useless elsewhere ;
needs to be changed everytime microprocesseur.mj is changed *)
if
List
.
mem
id
[
"t0"
;
"t1"
;
"t2"
;
"t3"
;
"t4"
;
"t5"
;
"t6"
;
"t7"
;
"_l_3
29
_16
29
"
;
"_l_3
34
_16
25
"
]
then
(
"_l_3
17
_16
14
"
;
"_l_3
21
_16
11
"
]
then
(
for
i
=
8
to
15
do
for
j
=
0
to
word_size
-
1
do
r
.
(
i
)
.
(
j
)
<-
bool_of_bit
((
default
.
(
i
-
8
)
/
...
...
@@ -377,7 +379,13 @@ let compile filename =
List
.
iter
(
fun
(
id
,
expr
)
->
match
expr
with
|
Eram
(
_
,
word_size
,
_
,
write_enable
,
write_addr
,
data
)
->
begin
|
Eram
(
_
,
word_size
,
_
,
write_enable
,
write_addr
,
data
)
->
if
!
debug
then
(
Format
.
printf
"%s@."
id
;
Array
.
iter
(
fun
t
->
Format
.
printf
"%a@ "
print_value
(
VBitArray
t
))
(
Env
.
find
id
!
rams
))
;
begin
match
eval_arg
!
env
write_enable
with
|
VBit
true
->
begin
match
eval_arg
!
env
data
with
...
...
@@ -436,10 +444,13 @@ let compile filename =
(* --- Output ---
For each variable in p.p_outputs, we print it in stdout.
We do so iff !frequence cycles have been done since the last output. *)
output
!
env
p
.
p_outputs
)
output
!
env
((
if
!
debug
then
[
"PC"
;
"command"
;
"ops"
]
else
[]
)
@
p
.
p_outputs
)
)
else
output
!
env
p
.
p_outputs
;
done
)
output
!
env
p
.
p_outputs
)
done
)
let
main
()
=
Arg
.
parse
...
...
@@ -460,9 +471,9 @@ let main () =
8
(
fun
i
->
Arg
.
Int
(
fun
n
->
default
.
(
i
)
<-
n
)))
,
""
]
default
.
(
i
)
<-
n
)))
,
""
;
"--debug"
,
Arg
.
Set
debug
,
"Prints a handful of useful information."
]
compile
""
;;
""
;;
main
()
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