mirror of
https://git.code.sf.net/p/ngspice/ngspice
synced 2026-08-22 13:57:32 +02:00
Add counter test. Check for usage of $d_lo, $d_hi, $d_nc usage with dff, jkff, dltch which will not translate to Xspice.
This commit is contained in:
committed by
Holger Vogt
parent
f7c519f149
commit
e8dfd16cb2
@@ -0,0 +1,57 @@
|
||||
counter.cir
|
||||
|
||||
.subckt counter high clear clk qa qb qc qd 5 7 9 11
|
||||
U1 JKFF(1) $G_DPWR $G_DGND HIGH CLEAR CLK HIGH HIGH QA 5
|
||||
+ D0_EFF IO_STD IO_LEVEL=0 MNTYMXDLY=2
|
||||
U2 JKFF(1) $G_DPWR $G_DGND HIGH CLEAR QA HIGH HIGH QB 7
|
||||
+ D0_EFF IO_STD IO_LEVEL=0 MNTYMXDLY=2
|
||||
U3 JKFF(1) $G_DPWR $G_DGND HIGH CLEAR QB HIGH HIGH QC 9
|
||||
+ D0_EFF IO_STD IO_LEVEL=0 MNTYMXDLY=2
|
||||
U4 JKFF(1) $G_DPWR $G_DGND HIGH CLEAR QC HIGH HIGH QD 11
|
||||
+ D0_EFF IO_STD IO_LEVEL=0 MNTYMXDLY=2
|
||||
.MODEL D0_EFF UEFF ()
|
||||
.ends counter
|
||||
|
||||
*** input sources ***
|
||||
vclk 100 0 pulse( 0.0 1.0 50ns 0ns 0ns 50ns 100ns )
|
||||
vreset 200 0 pulse( 1.0 0.0 10ns 0ns 0ns 50ns )
|
||||
vhigh 300 0 DC 1.0
|
||||
|
||||
*** adc_bridge blocks ***
|
||||
aconverter [100 200 300] [clock clr hi] adc_bridge1
|
||||
.model adc_bridge1 adc_bridge (in_low=0.1 in_high=0.9
|
||||
+ rise_delay=1.0e-12 fall_delay=1.0e-12)
|
||||
|
||||
*** resistors to ground ***
|
||||
r1 100 0 1k
|
||||
r2 200 0 1k
|
||||
r3 300 0 1k
|
||||
|
||||
x1 hi clr clock q1 q2 q3 q4 q1b q2b q3b q4b counter
|
||||
|
||||
*.TRAN 1e-008 4u 0
|
||||
.save all
|
||||
|
||||
.control
|
||||
TRAN 1e-008 4u 0
|
||||
run
|
||||
listing
|
||||
display
|
||||
edisplay
|
||||
*eprint hi clr clock q1 q2 q3 q4
|
||||
* save data to input directory
|
||||
cd $inputdir
|
||||
eprvcd hi clr clock q1 q2 q3 q4 > counter.vcd
|
||||
* plotting the vcd file with GTKWave
|
||||
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
|
||||
end
|
||||
quit
|
||||
.endc
|
||||
.END
|
||||
@@ -0,0 +1,10 @@
|
||||
# tcl script for gtkwave: show vcd file data created by ngspice
|
||||
set nfacs [ gtkwave::getNumFacs ]
|
||||
|
||||
for {set i 0} {$i < $nfacs } {incr i} {
|
||||
set facname [ gtkwave::getFacName $i ]
|
||||
set num_added [ gtkwave::addSignalsFromList $facname ]
|
||||
}
|
||||
|
||||
gtkwave::/Edit/UnHighlight_All
|
||||
gtkwave::/Time/Zoom/Zoom_Full
|
||||
Reference in New Issue
Block a user