Fix circuits so that gtkwave tests run on MacOS. Add encoder/decoder example.
This commit is contained in:
parent
f2eae6070e
commit
7d9b9ba4f1
|
|
@ -185,11 +185,7 @@ eprvcd r01 r02 r91 r92 clka clkb qd1 qc1 qb1 qa1 o1 o2 o3 o4 > 7490a.vcd
|
|||
if $oscompiled = 1 | $oscompiled = 8 ; MS Windows
|
||||
shell start gtkwave 7490a.vcd --script nggtk.tcl
|
||||
else
|
||||
if $oscompiled = 7 ; macOS, manual tweaking required (mark, insert, Zoom Fit)
|
||||
shell open -a gtkwave 7490a.vcd
|
||||
else ; Linux and others
|
||||
shell gtkwave 7490a.vcd --script nggtk.tcl &
|
||||
end
|
||||
shell gtkwave 7490a.vcd --script nggtk.tcl &
|
||||
end
|
||||
|
||||
*plot qd1 qc1 qb1 qa1 digitop
|
||||
|
|
|
|||
|
|
@ -212,11 +212,7 @@ eprvcd io0 io1 io2 io3 io4 io5 io6 io7 cp i_s0 i_s1 csi i_sebar i_m o_cso o_eq o
|
|||
if $oscompiled = 1 | $oscompiled = 8 ; MS Windows
|
||||
shell start gtkwave 74f524.vcd --script nggtk.tcl
|
||||
else
|
||||
if $oscompiled = 7 ; macOS, manual tweaking required (mark, insert, Zoom Fit)
|
||||
shell open -a gtkwave 74f524.vcd
|
||||
else ; Linux and others
|
||||
shell gtkwave 74f524.vcd --script nggtk.tcl &
|
||||
end
|
||||
shell gtkwave 74f524.vcd --script nggtk.tcl &
|
||||
end
|
||||
quit
|
||||
.endc
|
||||
|
|
|
|||
|
|
@ -80,11 +80,7 @@ eprvcd a3 a2 a1 a0 b3 b2 b1 b0 cin s3 s2 s1 s0 cout > behav-283-1.vcd
|
|||
if $oscompiled = 1 | $oscompiled = 8 ; MS Windows
|
||||
shell start gtkwave behav-283-1.vcd --script nggtk.tcl
|
||||
else
|
||||
if $oscompiled = 7 ; macOS, manual tweaking required (mark, insert, Zoom Fit)
|
||||
shell open -a gtkwave behav-283-1.vcd
|
||||
else ; Linux and others
|
||||
shell gtkwave behav-283-1.vcd --script nggtk.tcl &
|
||||
end
|
||||
shell gtkwave behav-283-1.vcd --script nggtk.tcl &
|
||||
end
|
||||
quit
|
||||
.endc
|
||||
|
|
|
|||
|
|
@ -80,11 +80,7 @@ eprvcd a3 a2 a1 a0 b3 b2 b1 b0 cin s3 s2 s1 s0 cout > behav-283.vcd
|
|||
if $oscompiled = 1 | $oscompiled = 8 ; MS Windows
|
||||
shell start gtkwave behav-283.vcd --script nggtk.tcl
|
||||
else
|
||||
if $oscompiled = 7 ; macOS, manual tweaking required (mark, insert, Zoom Fit)
|
||||
shell open -a gtkwave behav-283.vcd
|
||||
else ; Linux and others
|
||||
shell gtkwave behav-283.vcd --script nggtk.tcl &
|
||||
end
|
||||
shell gtkwave behav-283.vcd --script nggtk.tcl &
|
||||
end
|
||||
quit
|
||||
.endc
|
||||
|
|
|
|||
|
|
@ -465,11 +465,7 @@ eprvcd clk loadb d0 d1 d2 d3 qd qc qb qa q3 q2 q1 q0 ya yb yc yd > behav-568.vcd
|
|||
if $oscompiled = 1 | $oscompiled = 8 ; MS Windows
|
||||
shell start gtkwave behav-568.vcd --script nggtk.tcl
|
||||
else
|
||||
if $oscompiled = 7 ; macOS, manual tweaking required (mark, insert, Zoom Fit)
|
||||
shell open -a gtkwave behav-568.vcd
|
||||
else ; Linux and others
|
||||
shell gtkwave behav-568.vcd --script nggtk.tcl &
|
||||
end
|
||||
shell gtkwave behav-568.vcd --script nggtk.tcl &
|
||||
end
|
||||
quit
|
||||
.endc
|
||||
|
|
|
|||
|
|
@ -71,11 +71,7 @@ eprvcd 1a 1y oebar a1 y1 oe > behav-tristate-pulse.vcd
|
|||
if $oscompiled = 1 | $oscompiled = 8 ; MS Windows
|
||||
shell start gtkwave behav-tristate-pulse.vcd --script nggtk.tcl
|
||||
else
|
||||
if $oscompiled = 7 ; macOS, manual tweaking required (mark, insert, Zoom Fit)
|
||||
shell open -a gtkwave behav-tristate-pulse.vcd
|
||||
else ; Linux and others
|
||||
shell gtkwave behav-tristate-pulse.vcd --script nggtk.tcl &
|
||||
end
|
||||
shell gtkwave behav-tristate-pulse.vcd --script nggtk.tcl &
|
||||
end
|
||||
quit
|
||||
.endc
|
||||
|
|
|
|||
|
|
@ -46,11 +46,7 @@ eprvcd hi clr clock q1 q2 q3 q4 > counter.vcd
|
|||
if $oscompiled = 1 | $oscompiled = 8 ; MS Windows
|
||||
shell start gtkwave counter.vcd --script nggtk.tcl
|
||||
else
|
||||
if $oscompiled = 7 ; macOS, manual tweaking required (mark, insert, Zoom Fit)
|
||||
shell open -a gtkwave counter.vcd
|
||||
else ; Linux and others
|
||||
shell gtkwave counter.vcd --script nggtk.tcl &
|
||||
end
|
||||
shell gtkwave counter.vcd --script nggtk.tcl &
|
||||
end
|
||||
quit
|
||||
.endc
|
||||
|
|
|
|||
|
|
@ -68,11 +68,7 @@ eprvcd a b c d o0 o1 o2 o3 o4 o5 o6 o7 o8 o9 > decoder.vcd
|
|||
if $oscompiled = 1 | $oscompiled = 8 ; MS Windows
|
||||
shell start gtkwave decoder.vcd --script nggtk.tcl
|
||||
else
|
||||
if $oscompiled = 7 ; macOS, manual tweaking required (mark, insert, Zoom Fit)
|
||||
shell open -a gtkwave decoder.vcd
|
||||
else ; Linux and others
|
||||
shell gtkwave decoder.vcd --script nggtk.tcl &
|
||||
end
|
||||
shell gtkwave decoder.vcd --script nggtk.tcl &
|
||||
end
|
||||
quit
|
||||
.endc
|
||||
|
|
|
|||
|
|
@ -0,0 +1,162 @@
|
|||
Interface 74147 encoder with 74145 decoder
|
||||
|
||||
* ----------------------------------------------------------- 74145 ------
|
||||
* BCD-To-Decimal Decoders/Drivers
|
||||
*
|
||||
* The TTL Logic Data Book, 1988, TI Pages 2-447 to 2-449
|
||||
* bss 3/17/94
|
||||
*
|
||||
.SUBCKT 74145 A B C D O0 O1 O2 O3 O4 O5 O6 O7 O8 O9
|
||||
+ optional: DPWR=$G_DPWR DGND=$G_DGND
|
||||
+ params: MNTYMXDLY=0 IO_LEVEL=0
|
||||
|
||||
U1LOG LOGICEXP(4,10) DPWR DGND
|
||||
+ A B C D
|
||||
+ O0_O O1_O O2_O O3_O O4_O O5_O O6_O O7_O O8_O O9_O
|
||||
+ D0_GATE IO_STD MNTYMXDLY={MNTYMXDLY} IO_LEVEL={IO_LEVEL}
|
||||
+
|
||||
+ LOGIC:
|
||||
+ abar = {~A}
|
||||
+ bbar = {~B}
|
||||
+ cbar = {~C}
|
||||
+ dbar = {~D}
|
||||
+ O0_O = {~(abar & bbar & cbar & dbar)}
|
||||
+ O1_O = {~(A & bbar & cbar & dbar)}
|
||||
+ O2_O = {~(abar & B & cbar & dbar)}
|
||||
+ O3_O = {~(A & B & cbar & dbar)}
|
||||
+ O4_O = {~(abar & bbar & C & dbar)}
|
||||
+ O5_O = {~(A & bbar & C & dbar)}
|
||||
+ O6_O = {~(abar & B & C & dbar)}
|
||||
+ O7_O = {~(A & B & C & dbar)}
|
||||
+ O8_O = {~(abar & bbar & cbar & D)}
|
||||
+ O9_O = {~(A & bbar & cbar & D)}
|
||||
|
||||
U2DLY PINDLY(10,0,0) DPWR DGND
|
||||
+ O0_O O1_O O2_O O3_O O4_O O5_O O6_O O7_O O8_O O9_O
|
||||
+ O0 O1 O2 O3 O4 O5 O6 O7 O8 O9
|
||||
+ IO_STD MNTYMXDLY={MNTYMXDLY} IO_LEVEL={IO_LEVEL}
|
||||
+
|
||||
+ PINDLY:
|
||||
+ O0 O1 O2 O3 O4 O5 O6 O7 O8 O9 = {
|
||||
+ CASE(
|
||||
+ DELAY(-1,-1,50ns))}
|
||||
|
||||
.ENDS 74145
|
||||
*
|
||||
* ----------------------------------------------------------- 74147 ------
|
||||
* 10-Line To 4-Line Priority Encoders
|
||||
*
|
||||
* The TTL Logic Data Book, 1988, TI Pages 2-451 to 2-456
|
||||
* bss 3/18/94
|
||||
*
|
||||
.SUBCKT 74147 I1 I2 I3 I4 I5 I6 I7 I8 I9 A B C D
|
||||
+ optional: DPWR=$G_DPWR DGND=$G_DGND
|
||||
+ params: MNTYMXDLY=0 IO_LEVEL=0
|
||||
|
||||
U1LOG LOGICEXP(9,4) DPWR DGND
|
||||
+ I1 I2 I3 I4 I5 I6 I7 I8 I9
|
||||
+ A_O B_O C_O D_O
|
||||
+ D0_GATE IO_STD MNTYMXDLY={MNTYMXDLY} IO_LEVEL={IO_LEVEL}
|
||||
+
|
||||
+ LOGIC:
|
||||
+ i1bar = {~I1}
|
||||
+ i2bar = {~I2}
|
||||
+ i3bar = {~I3}
|
||||
+ i4bar = {~I4}
|
||||
+ i5bar = {~I5}
|
||||
+ i6bar = {~I6}
|
||||
+ i7bar = {~I7}
|
||||
+ i8bar = {~I8}
|
||||
+ i9bar = {~I9}
|
||||
+ nor89 = {~(i8bar | i9bar)}
|
||||
+ A_O = {~((i1bar & I2 & I4 & I6 & nor89) | (i3bar & I4 & I6 & nor89) | (i5bar & I6 & nor89) |
|
||||
+ (i7bar & nor89) | i9bar)}
|
||||
+ B_O = {~((i2bar & I4 & I5 & nor89) | (i3bar & I4 & I5 & nor89) | (i6bar & nor89) |
|
||||
+ (i7bar & nor89))}
|
||||
+ C_O = {~((i4bar & nor89) | (i5bar & nor89) | (i6bar & nor89) | (i7bar & nor89))}
|
||||
+ D_O = {~(i8bar | i9bar)}
|
||||
|
||||
U2DLY PINDLY(4,0,9) DPWR DGND
|
||||
+ A_O B_O C_O D_O
|
||||
+ I1 I2 I3 I4 I5 I6 I7 I8 I9
|
||||
+ A B C D
|
||||
+ IO_STD MNTYMXDLY={MNTYMXDLY} IO_LEVEL={IO_LEVEL}
|
||||
+
|
||||
+ BOOLEAN:
|
||||
+ IN1 = {CHANGED(I1,0) & I2=='1 & I3=='1 & I4=='1 & I5=='1 & I6=='1 & I7=='1 & I8=='1 &
|
||||
+ I9=='1}
|
||||
+ IN2 = {CHANGED(I2,0) & I1=='1 & I3=='1 & I4=='1 & I5=='1 & I6=='1 & I7=='1 & I8=='1 &
|
||||
+ I9=='1}
|
||||
+ IN3 = {CHANGED(I3,0) & I1=='1 & I2=='1 & I4=='1 & I5=='1 & I6=='1 & I7=='1 & I8=='1 &
|
||||
+ I9=='1}
|
||||
+ IN4 = {CHANGED(I4,0) & I1=='1 & I2=='1 & I3=='1 & I5=='1 & I6=='1 & I7=='1 & I8=='1 &
|
||||
+ I9=='1}
|
||||
+ IN5 = {CHANGED(I5,0) & I1=='1 & I2=='1 & I3=='1 & I4=='1 & I6=='1 & I7=='1 & I8=='1 &
|
||||
+ I9=='1}
|
||||
+ IN6 = {CHANGED(I6,0) & I1=='1 & I2=='1 & I3=='1 & I4=='1 & I5=='1 & I7=='1 & I8=='1 &
|
||||
+ I9=='1}
|
||||
+ IN7 = {CHANGED(I7,0) & I1=='1 & I2=='1 & I3=='1 & I4=='1 & I5=='1 & I6=='1 & I8=='1 &
|
||||
+ I9=='1}
|
||||
+ IN8 = {CHANGED(I8,0) & I1=='1 & I2=='1 & I3=='1 & I4=='1 & I5=='1 & I6=='1 & I7=='1 &
|
||||
+ I9=='1}
|
||||
+ IN9 = {CHANGED(I9,0) & I1=='1 & I2=='1 & I3=='1 & I4=='1 & I5=='1 & I6=='1 & I7=='1 &
|
||||
+ I8=='1}
|
||||
+ IN = {IN1 | IN2 | IN3 | IN4 | IN5 | IN6 | IN7 | IN8 | IN9}
|
||||
+
|
||||
+ PINDLY:
|
||||
+ A B C = {
|
||||
+ CASE(
|
||||
+ IN & TRN_LH, DELAY(-1,9ns,14ns),
|
||||
+ IN & TRN_HL, DELAY(-1,7ns,11ns),
|
||||
+ TRN_LH, DELAY(-1,13ns,19ns),
|
||||
+ TRN_HL, DELAY(-1,12ns,19ns),
|
||||
+ DELAY(-1,14ns,20ns))}
|
||||
+
|
||||
+ D = {
|
||||
+ CASE(
|
||||
+ (IN8 | IN9) & TRN_LH, DELAY(-1,9ns,14ns),
|
||||
+ (IN8 | IN9) & TRN_HL, DELAY(-1,7ns,11ns),
|
||||
+ TRN_LH, DELAY(-1,13ns,19ns),
|
||||
+ TRN_HL, DELAY(-1,12ns,19ns),
|
||||
+ DELAY(-1,14ns,20ns))}
|
||||
|
||||
.ENDS 74147
|
||||
*
|
||||
|
||||
* .SUBCKT 74147 I1 I2 I3 I4 I5 I6 I7 I8 I9 A B C D
|
||||
X1 i1 i2 i3 i4 i5 i6 i7 i8 i9 a b c d 74147
|
||||
|
||||
* .SUBCKT 74145 A B C D O0 O1 O2 O3 O4 O5 O6 O7 O8 O9
|
||||
X2 a_i b_i c_i d_i O0 O1 O2 O3 O4 O5 O6 O7 O8 O9 74145
|
||||
|
||||
a_1 a a_i d_inv_0
|
||||
a_2 b b_i d_inv_0
|
||||
a_3 c c_i d_inv_0
|
||||
a_4 d d_i d_inv_0
|
||||
.model d_inv_0 d_inverter(inertial_delay=true)
|
||||
|
||||
a1 [i1 i2 i3 i4 i5 i6 i7 i8 i9] input_vec1
|
||||
.model input_vec1 d_source(input_file = "encoder.stim")
|
||||
|
||||
.TRAN 4e-008 2U 0
|
||||
.save all
|
||||
|
||||
.control
|
||||
listing
|
||||
run
|
||||
eprint i1 i2 i3 i4 i5 i6 i7 i8 i9
|
||||
eprint d c b a
|
||||
eprint o0 o1 o2 o3 o4 o5 o6 o7 o8 o9
|
||||
* save data to input directory
|
||||
cd $inputdir
|
||||
eprvcd i1 i2 i3 i4 i5 i6 i7 i8 i9 a b c d o0 o1 o2 o3 o4 o5 o6 o7 o8 o9 > encoder.vcd
|
||||
* plotting the vcd file with GTKWave
|
||||
if $oscompiled = 1 | $oscompiled = 8 ; MS Windows
|
||||
shell start gtkwave encoder.vcd --script nggtk.tcl
|
||||
else
|
||||
shell gtkwave encoder.vcd --script nggtk.tcl &
|
||||
end
|
||||
quit
|
||||
.endc
|
||||
|
||||
.END
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
* t i i i i i i i i i
|
||||
* i 1 2 3 4 5 6 7 8 9
|
||||
* m
|
||||
* e
|
||||
0ns 1s 1s 1s 1s 1s 1s 1s 1s 1s
|
||||
100ns 1s 1s 1s 1s 1s 1s 1s 1s 0s
|
||||
200ns 1s 1s 1s 1s 1s 1s 1s 0s 1s
|
||||
300ns 1s 1s 1s 1s 1s 1s 0s 1s 1s
|
||||
400ns 1s 1s 1s 1s 1s 0s 1s 1s 1s
|
||||
500ns 1s 1s 1s 1s 0s 1s 1s 1s 1s
|
||||
600ns 1s 1s 1s 0s 1s 1s 1s 1s 1s
|
||||
700ns 1s 1s 0s 1s 1s 1s 1s 1s 1s
|
||||
800ns 1s 0s 1s 1s 1s 1s 1s 1s 1s
|
||||
900ns 0s 1s 1s 1s 1s 1s 1s 1s 1s
|
||||
1.0us 1s 1s 1s 1s 1s 1s 1s 1s 1s
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
Componenet type 283 : 4-bit adder
|
||||
Componenent type 283 : 4-bit adder
|
||||
|
||||
.subckt 283 a1 a2 a3 a4 b1 b2 b3 b4 c0 sigma1 sigma2 sigma3 sigma4 c4
|
||||
+ optional: DPWR=$G_DPWR DGND=$G_DGND
|
||||
|
|
@ -339,11 +339,7 @@ eprvcd a4 a3 a2 a1 b4 b3 b2 b1 c0 sigma4 sigma3 sigma2 sigma1 c4 > ex283.vcd
|
|||
if $oscompiled = 1 | $oscompiled = 8 ; MS Windows
|
||||
shell start gtkwave ex283.vcd --script nggtk.tcl
|
||||
else
|
||||
if $oscompiled = 7 ; macOS, manual tweaking required (mark, insert, Zoom Fit)
|
||||
shell open -a gtkwave ex283.vcd
|
||||
else ; Linux and others
|
||||
shell gtkwave ex283.vcd --script nggtk.tcl &
|
||||
end
|
||||
shell gtkwave ex283.vcd --script nggtk.tcl &
|
||||
end
|
||||
quit
|
||||
.endc
|
||||
|
|
|
|||
Loading…
Reference in New Issue