mirror of https://github.com/zachjs/sv2v.git
support a few other gate types
This commit is contained in:
parent
96469b7bbd
commit
1edaab8e7d
|
|
@ -114,24 +114,42 @@ instance Show AlwaysKW where
|
||||||
|
|
||||||
data NInputGateKW
|
data NInputGateKW
|
||||||
= GateAnd
|
= GateAnd
|
||||||
| GateBufif0
|
|
||||||
| GateNand
|
| GateNand
|
||||||
| GateOr
|
| GateOr
|
||||||
| GateNor
|
| GateNor
|
||||||
| GateRpmos
|
|
||||||
| GateXor
|
| GateXor
|
||||||
| GateXnor
|
| GateXnor
|
||||||
|
| GateBufif0
|
||||||
|
| GateBufif1
|
||||||
|
| GateNotif0
|
||||||
|
| GateNotif1
|
||||||
|
| GateCmos
|
||||||
|
| GateRcmos
|
||||||
|
| GateNmos
|
||||||
|
| GatePmos
|
||||||
|
| GateRnmos
|
||||||
|
| GateRpmos
|
||||||
deriving Eq
|
deriving Eq
|
||||||
|
|
||||||
instance Show NInputGateKW where
|
instance Show NInputGateKW where
|
||||||
show GateAnd = "and"
|
show GateAnd = "and"
|
||||||
show GateBufif0 = "bufif0"
|
|
||||||
show GateNand = "nand"
|
show GateNand = "nand"
|
||||||
show GateOr = "or"
|
show GateOr = "or"
|
||||||
show GateNor = "nor"
|
show GateNor = "nor"
|
||||||
show GateRpmos = "rpmos"
|
|
||||||
show GateXor = "xor"
|
show GateXor = "xor"
|
||||||
show GateXnor = "xnor"
|
show GateXnor = "xnor"
|
||||||
|
show GateBufif0 = "bufif0"
|
||||||
|
show GateBufif1 = "bufif1"
|
||||||
|
show GateNotif0 = "notif0"
|
||||||
|
show GateNotif1 = "notif1"
|
||||||
|
-- these technically require exactly 3 inputs: input, ncontrol, pcontrol
|
||||||
|
show GateCmos = "cmos"
|
||||||
|
show GateRcmos = "rcmos"
|
||||||
|
-- these technically require exactly 2 inputs: input, enable
|
||||||
|
show GateNmos = "nmos"
|
||||||
|
show GatePmos = "pmos"
|
||||||
|
show GateRnmos = "rnmos"
|
||||||
|
show GateRpmos = "rpmos"
|
||||||
|
|
||||||
data NOutputGateKW
|
data NOutputGateKW
|
||||||
= GateBuf
|
= GateBuf
|
||||||
|
|
|
||||||
|
|
@ -873,13 +873,21 @@ OptGateName :: { (Identifier, [Range]) }
|
||||||
|
|
||||||
NInputGateKW :: { NInputGateKW }
|
NInputGateKW :: { NInputGateKW }
|
||||||
: "and" { GateAnd }
|
: "and" { GateAnd }
|
||||||
| "bufif0" { GateBufif0 }
|
|
||||||
| "nand" { GateNand }
|
| "nand" { GateNand }
|
||||||
| "or" { GateOr }
|
| "or" { GateOr }
|
||||||
| "nor" { GateNor }
|
| "nor" { GateNor }
|
||||||
| "rpmos" { GateRpmos }
|
|
||||||
| "xor" { GateXor }
|
| "xor" { GateXor }
|
||||||
| "xnor" { GateXnor }
|
| "xnor" { GateXnor }
|
||||||
|
| "bufif0" { GateBufif0 }
|
||||||
|
| "bufif1" { GateBufif1 }
|
||||||
|
| "notif0" { GateNotif0 }
|
||||||
|
| "notif1" { GateNotif1 }
|
||||||
|
| "cmos" { GateCmos }
|
||||||
|
| "rcmos" { GateRcmos }
|
||||||
|
| "nmos" { GateNmos }
|
||||||
|
| "pmos" { GatePmos }
|
||||||
|
| "rnmos" { GateRnmos }
|
||||||
|
| "rpmos" { GateRpmos }
|
||||||
NOutputGateKW :: { NOutputGateKW }
|
NOutputGateKW :: { NOutputGateKW }
|
||||||
: "buf" { GateBuf }
|
: "buf" { GateBuf }
|
||||||
| "not" { GateNot }
|
| "not" { GateNot }
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,29 @@
|
||||||
module top;
|
module top;
|
||||||
reg input_a;
|
reg input_a, input_b, input_c;
|
||||||
reg input_b;
|
|
||||||
|
|
||||||
wire output_and;
|
|
||||||
wire output_and_delay;
|
|
||||||
wire output_not;
|
|
||||||
wire output_buf_delay;
|
|
||||||
wire output_bufif0_delay;
|
|
||||||
wire output_rpmos;
|
|
||||||
|
|
||||||
|
wire output_and, output_and_delay;
|
||||||
|
wire output_not, output_buf_delay;
|
||||||
and (output_and, input_a, input_b);
|
and (output_and, input_a, input_b);
|
||||||
and #1 (output_and_delay, input_a, input_b);
|
and #1 (output_and_delay, input_a, input_b);
|
||||||
not (output_not, input_a);
|
not (output_not, input_a);
|
||||||
buf #2 foo_name (output_buf_delay, input_a);
|
buf #2 foo_name (output_buf_delay, input_a);
|
||||||
|
|
||||||
|
wire output_bufif0_delay, output_bufif1_delay;
|
||||||
|
wire output_notif0_delay, output_notif1_delay;
|
||||||
bufif0 (output_bufif0_delay, input_a, input_b);
|
bufif0 (output_bufif0_delay, input_a, input_b);
|
||||||
|
bufif1 (output_bufif1_delay, input_a, input_b);
|
||||||
|
notif0 (output_notif0_delay, input_a, input_b);
|
||||||
|
notif1 (output_notif1_delay, input_a, input_b);
|
||||||
|
|
||||||
|
wire output_cmos, output_rcmos;
|
||||||
|
cmos (output_cmos, input_a, input_b, input_c);
|
||||||
|
rcmos (output_rcmos, input_a, input_b, input_c);
|
||||||
|
|
||||||
|
wire output_nmos, output_pmos;
|
||||||
|
wire output_rnmos, output_rpmos;
|
||||||
|
nmos (output_nmos, input_a, input_b);
|
||||||
|
pmos (output_pmos, input_a, input_b);
|
||||||
|
rnmos (output_rnmos, input_a, input_b);
|
||||||
rpmos (output_rpmos, input_a, input_b);
|
rpmos (output_rpmos, input_a, input_b);
|
||||||
|
|
||||||
wire output_nand, output_or, output_nor, output_xor, output_xnor;
|
wire output_nand, output_or, output_nor, output_xor, output_xnor;
|
||||||
|
|
@ -27,21 +37,30 @@ module top;
|
||||||
$monitor("%3d ", $time,
|
$monitor("%3d ", $time,
|
||||||
input_a, input_b,
|
input_a, input_b,
|
||||||
output_and, output_and_delay,
|
output_and, output_and_delay,
|
||||||
output_not, output_buf_delay, output_bufif0_delay,
|
output_not, output_buf_delay,
|
||||||
|
output_bufif0_delay, output_bufif1_delay,
|
||||||
|
output_notif0_delay, output_notif1_delay,
|
||||||
|
output_cmos, output_rcmos,
|
||||||
|
output_nmos, output_pmos,
|
||||||
|
output_rnmos, output_rpmos,
|
||||||
output_nand, output_or, output_nor, output_xor, output_xnor);
|
output_nand, output_or, output_nor, output_xor, output_xnor);
|
||||||
|
|
||||||
#1;
|
#1;
|
||||||
#1; input_a = 1;
|
#1; input_a = 1;
|
||||||
|
#1; input_c = 0;
|
||||||
#1; input_b = 0;
|
#1; input_b = 0;
|
||||||
#1; input_b = 1;
|
#1; input_b = 1;
|
||||||
|
#1; input_c = 1;
|
||||||
#1;
|
#1;
|
||||||
|
|
||||||
#1; input_a = 0;
|
#1; input_a = 0;
|
||||||
#1; input_b = 0;
|
#1; input_b = 0;
|
||||||
#1; input_a = 0;
|
#1; input_a = 0;
|
||||||
#1; input_b = 1;
|
#1; input_b = 1;
|
||||||
|
#1; input_c = 0;
|
||||||
#1; input_a = 1;
|
#1; input_a = 1;
|
||||||
#1; input_b = 0;
|
#1; input_b = 0;
|
||||||
|
#1; input_c = 1;
|
||||||
#1; input_a = 1;
|
#1; input_a = 1;
|
||||||
#1; input_b = 1;
|
#1; input_b = 1;
|
||||||
#1;
|
#1;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue