Commit 6b66e7a3 authored by Aliaume Lopez's avatar Aliaume Lopez

Added NOT construction

parent 4e9dd27b
......@@ -72,7 +72,7 @@ The constant circuits are in capital letters. The following circuits are availab
* FORK
* JOIN
* MUX
* MUX
* NMOS (first entry = G, second entry = S)
* PMOS (first entry = G, second entry = S)
* BOT (value bottom)
......@@ -81,6 +81,9 @@ The constant circuits are in capital letters. The following circuits are availab
* LOW (value low)
* DISC (disconnect gate)
* WAIT (delay node)
* AND (logical and gate)
* OR (logical or gate)
* NOT (logical not gate)
* Any other capital letter circuit is considered as a « box » with type 1->1, except `F`, `G` and `H` (for debugging purpose) and circuit that are declared
The symmetry is not a circuit yet.
......
......@@ -153,6 +153,7 @@ let convert_label = function
| "DISC" -> Disconnect
| "OR" -> Gate Or
| "AND" -> Gate And
| "NOT" -> Gate Not
| "FORK" -> Gate Fork
| "JOIN" -> Gate Join
| x -> Gate (Box x)
......
link xO:xI yO:yI for
HIGH . link xO:xI yO:yI for
PAR
xO:
(:xI | :yI) . AND
......
......@@ -155,6 +155,7 @@ let circuit_of_name = function
| "F" -> const "F" 1 1
| "G" -> const "G" 1 1
| "H" -> const "H" 2 2
| "NOT" -> const "NOT" 1 1
| "PMOS" -> const "PMOS" 2 1
| "NMOS" -> const "NMOS" 2 1
| "HIGH" -> const "HIGH" 0 1
......
......@@ -98,6 +98,7 @@ type gate =
| Nmos
| Pmos
| And
| Not
| Or
| Box of string
| Wait
......
......@@ -245,6 +245,18 @@ let reduce_or inputs =
with
Match_failure _ -> NoOP;;
let reduce_not inputs =
try
let [a] = inputs in
match a with
| Some (Value High) -> Result Low
| Some (Value Low) -> Result High
| Some (Value Top) -> Result Top
| Some (Value Bottom) -> Result Bottom
| _ -> NoOP
with
Match_failure _ -> NoOP;;
(*
* A small function that gives the lowest common
......@@ -293,7 +305,8 @@ let fun_of_gate = function
| Join -> reduce_join
| And -> reduce_and
| Or -> reduce_or
| _ -> (fun _ -> NoOP);;
| Not -> reduce_not
| _ -> (fun _ -> NoOP);;
(**
* Gate reduction
......
Markdown is supported
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