Help with PSPICE digital simulation

Mar 13, 2005 18 Replies

hello everyone,



i'm trying to simulate flip-flop circuits using nand gates only (cross-coupled nand gates) for a school project with PSPICE. however the outputs of my nand gates ( Q and Qnot ) always seem to be at the "don't care" (or "X") state after i run the simulation. is this because the simulator doesn't know what are the initial states of Q and Qnot. is there a way around this? any help is appreciated. thank you.



patrick antoun



Digital Setup, Flip-Flop Initialization

...Jim Thompson

| James E.Thompson, P.E. | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC\'s and Discrete Systems | manus | | Phoenix, Arizona Voice:(480)460-2350 | | | E-mail Address at Website Fax:(480)460-2142 | Brass Rat | | http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

thanks, will this work (digital setup) even though i'm not actually using any flip-flops (my circuit has only cross-coupled nand gates)? If so, where do i find this digital setup? patrick

i forgot to mention that i'm using pspice from Orcad version 9.2.3 (Cadence). thanks again, patrick

[snip]

Analysis Setup

You could also try a .IC=0 (initial condition) on one of the NAND outputs.

...Jim Thompson

-- | James E.Thompson, P.E. | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona Voice:(480)460-2350 | | | E-mail Address at Website Fax:(480)460-2142 | Brass Rat | |

formatting link
| 1962 | I love to cook with wine. Sometimes I even put it in the food.

Patrick, Take a look at your design. What is setting the state at start-up? Your design SHOULD include signal or circuitry to set that initial state at the beginning. Even if you have a few digital sources that go from 0 or 1 to Z (high impedance) just to kick things off...

Charlie -- Edmondson Engineering Unique Solutions to Unusual Problems

Hmmmm?

Charlie,

Am I learning a NEW trick? Can part "DigStim" do that, 0 -> Z? Or what part should I use?

...Jim Thompson

| James E.Thompson, P.E. | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC\'s and Discrete Systems | manus | | Phoenix, Arizona Voice:(480)460-2350 | | | E-mail Address at Website Fax:(480)460-2142 | Brass Rat | | http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

Wellll.... you could, but that invokes the stimulus editor.

I would use a stim1 part. That lets you give it a series of commands in time state format.

0s 0 1us 1 2us Z

is one such command sequence. The other stim parts let you have buss stimulus defined.

Charlie -- Edmondson Engineering Unique Solutions to Unusual Problems

I called it by the wrong name. That will be VERY useful... THANKS!

...Jim Thompson

| James E.Thompson, P.E. | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC\'s and Discrete Systems | manus | | Phoenix, Arizona Voice:(480)460-2350 | | | E-mail Address at Website Fax:(480)460-2142 | Brass Rat | | http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

Charlie, Since i'm new to digital simulation using PSPICE 9.2.X i guess i don't have anything that sets the state of the outputs (Q and Qnot) of the cross-coupled nand gates. if i was actually writing the netlist i would include a .IC or .NODESET command. but since Capture is all GUI i don't know how to include this kind of initial condition in my circuit. i tried connecting a 10k pull-up resistor for the output of one nand gate (Q) to VCC. this seemed to sort of work, but it makes the circuit analog/digital (by introducing analog components) and the square wave at the output of the flip-flop wasn't as nice looking and the clock source. there must be a way to accomplish this without having to use a pull-up resistor. ultimately i'm trying to simulate a clocked JK flip-flop (with preset and reset asynchronous inputs) using 2-input and 3-input nand gates. this is for a school project. i greatly appreciate and help with this problem. thanks again.

Patrick

Charlie told us how...

"I would use a stim1 part. That lets you give it a series of commands in time state format"

(Use part named "STIM1")

0s 0 1us Z

Tie to one Q of the cross-coupled NANDs.

...Jim Thompson

| James E.Thompson, P.E. | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC\'s and Discrete Systems | manus | | Phoenix, Arizona Voice:(480)460-2350 | | | E-mail Address at Website Fax:(480)460-2142 | Brass Rat | | http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

No Problem!

Just remember that this uses the standard stim set up in digio.lib, so it is typically 0-5v, and goes up to about 2Ghz reliably.

Also, the Z is what is set up in your digital options, so if you need a really high Z (the default IIRC is only 10K) you need to change your options.

Charlie -- Edmondson Engineering Unique Solutions to Unusual Problems

And, depending on your set up, you might need the complement on the other one. Remember, if you get an indeterminate signal in your setup, it can propogate throughout your circuit...

Charlie -- Edmondson Engineering Unique Solutions to Unusual Problems

Hi Charlie,

Looks like the library is actually named "dig_io.lib" ;-)

I find "Z" is 1Meg in most logic families, but 200K in TTL.

I couldn't find "Z" defined in relationship to "STIM1"

Where is that set?

...Jim Thompson

| James E.Thompson, P.E. | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC\'s and Discrete Systems | manus | | Phoenix, Arizona Voice:(480)460-2350 | | | E-mail Address at Website Fax:(480)460-2142 | Brass Rat | | http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

In your sim options, it is called DIGDRVZ, and on my version defaults to 20K

Usually an advanced digital option.

Charlie -- Edmondson Engineering Unique Solutions to Unusual Problems

Is that available readily to those of us still following the true faith (AKA MicroSim PSpice Schematics) ?:-)

Aha! Found it right there in the plain vanilla Options settings.

Is there a way to set Options to always be the values I want, and to always appear as the defaults?

...Jim Thompson

| James E.Thompson, P.E. | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC\'s and Discrete Systems | manus | | Phoenix, Arizona Voice:(480)460-2350 | | | E-mail Address at Website Fax:(480)460-2142 | Brass Rat | | http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

Hi Jim, Not really. You can always create a .inc file with the options set the way you want.

Or wait, can you set them in the pspice.ini file? No, I guess not. In Capture, you can now import a standard simulation profile... 8-)

Charlie

Or get a substitute with a MicroSim-Schematics-like front-end...

formatting link
;-)

But I guess you are right... just do a .INC*

Any advantage of .INC* versus .LIB*

...Jim Thompson

| James E.Thompson, P.E. | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC\'s and Discrete Systems | manus | | Phoenix, Arizona Voice:(480)460-2350 | | | E-mail Address at Website Fax:(480)460-2142 | Brass Rat | | http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

Include files add all the lines into the netlist. A library only adds called models, so use includes for setting options and adding 'stuff'!

Charlie -- Edmondson Engineering Unique Solutions to Unusual Problems

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required