Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
stage-L3-2016
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aliaume Lopez
stage-L3-2016
Commits
2f64319c
Commit
2f64319c
authored
Aug 01, 2016
by
Aliaume Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Waveform problems
parent
5255a789
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
14 deletions
+53
-14
ptg.ml
ptg.ml
+4
-6
rewriting.ml
rewriting.ml
+49
-8
No files found.
ptg.ml
View file @
2f64319c
...
...
@@ -105,13 +105,12 @@ type value =
|
High
|
Low
|
Top
|
Bottom
|
Wave
of
value
list
;;
|
Bottom
;;
type
label
=
|
Disconnect
(* dangling node *)
|
Value
of
value
|
Value
of
value
|
Wave
of
value
list
|
Gate
of
gate
;;
...
...
@@ -196,8 +195,7 @@ let rec string_of_value = function
|
High
->
"H"
|
Low
->
"L"
|
Top
->
"T"
|
Bottom
->
"Z"
|
Wave
w
->
w
|>
List
.
map
string_of_value
|>
String
.
concat
"::"
;;
|
Bottom
->
"Z"
;;
let
string_of_label
=
function
|
Disconnect
->
"D"
...
...
rewriting.ml
View file @
2f64319c
...
...
@@ -144,20 +144,61 @@ let reduce_mux inputs =
* nmos
* pmos
*)
let
reduce_nmos
=
fun
_
->
NoOP
;;
let
reduce_pmos
=
fun
_
->
NoOP
;;
let
reduce_nmos
inputs
=
try
let
[
a
;
b
]
=
inputs
in
match
(
a
,
b
)
with
|
Some
(
Value
Bottom
)
,
_
->
Result
Top
|
Some
(
Value
Low
)
,
_
->
Result
Bottom
|
Some
(
Value
High
)
,
Some
(
Value
High
)
->
Result
Bottom
|
Some
(
Value
High
)
,
Some
(
Value
x
)
->
Result
x
|
Some
(
Value
Top
)
,
Some
(
Value
Bottom
)
->
Result
Bottom
|
Some
(
Value
Top
)
,
Some
(
Value
_
)
->
Result
Top
|
_
->
NoOP
with
Match_failure
_
->
NoOP
;;
let
reduce_pmos
inputs
=
try
let
[
a
;
b
]
=
inputs
in
match
(
a
,
b
)
with
|
Some
(
Value
Bottom
)
,
_
->
Result
Top
|
Some
(
Value
Low
)
,
_
->
Result
Bottom
|
Some
(
Value
High
)
,
Some
(
Value
High
)
->
Result
Bottom
|
Some
(
Value
High
)
,
Some
(
Value
x
)
->
Result
x
|
Some
(
Value
Top
)
,
Some
(
Value
Bottom
)
->
Result
Bottom
|
Some
(
Value
Top
)
,
Some
(
Value
_
)
->
Result
Top
|
_
->
NoOP
with
Match_failure
_
->
NoOP
;;
let
combine_values
v1
v2
=
match
(
v1
,
v2
)
with
|
Low
,
Low
->
Low
|
High
,
High
->
High
|
Bottom
,
x
->
x
|
x
,
Bottom
->
x
|
High
,
Low
->
Top
|
Low
,
High
->
Top
|
Top
,
x
->
Top
|
x
,
Top
->
Top
;;
let
rec
combine_values_list
w1
w2
=
match
(
w1
,
w2
)
with
|
[]
,_
->
w2
|
_
,
[]
->
w1
|
a
::
b
,
c
::
d
->
(
combine_values
a
c
)
::
combine_values_list
b
d
;;
let
reduce_join
inputs
=
try
let
[
a
;
b
]
=
inputs
in
match
(
a
,
b
)
with
|
Some
(
Value
High
)
,
Some
(
Value
Low
)
->
Result
Top
|
Some
(
Value
Low
)
,
Some
(
Value
High
)
->
Result
Top
|
Some
(
Value
High
)
,
Some
(
Value
High
)
->
Result
High
|
Some
(
Value
Low
)
,
Some
(
Value
Low
)
->
Result
Low
|
Some
(
Value
Top
)
,
_
->
Result
Top
|
_
,
Some
(
Value
Top
)
->
Result
Top
(* Fist of all, the short-circuits *)
|
Some
(
Value
Bottom
)
,_
->
Wire
1
|
_
,
Some
(
Value
Bottom
)
->
Wire
0
(* Then the list values *)
|
Some
(
Value
x
)
,
Some
(
Value
y
)
->
Result
(
combine_values
x
y
)
(* otherwise do nothing *)
|
_
->
NoOP
with
Match_failure
_
->
NoOP
;;
...
...
Write
Preview
Markdown
is supported
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