Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
68
Добавлен:
06.06.2017
Размер:
3.31 Mб
Скачать

If either the CLOCK node or the DATA node are unknown, the check is skipped to avoid the profusion of errors that usually result. If a clock is X when DATA changes or vice-versa, the error has probably already been flagged elsewhere.

The constraint is checked only if <boolean expression> is true. If the number of constraint warning messages exceeds <limit value>, no further messages are issued. <extra message text> if any, is added to the standard error message.

WIDTH:

Marks the start of a group of one or more <width specifications> which have the following format:

+WIDTH: +NODE=<input node> +[MIN_LO=<time value>] +[MIN_HI=<time value>]

+[WHEN=<boolean expression>] +[MESSAGE="<extra message text>"] +[ERRORLIMIT=<limit value>]

The NODE argument, <input node>, defines the node whose input is to be checked for width.

The MIN_LO argument, <time value>, defines the minimum time that <input node> can be at the 0 level. If <time value> is specified as zero, the width check is not performed.

The MIN_HI argument, <time value>, defines the minimum time that <input node> can be at the 1 level. If <time value> is specified as zero, the width check is not performed.

At least one of the two forms, MIN_LO or MIN_HI must be present inside every WIDTH specification.

The constraint is checked only if <boolean expression> is true. If the number of constraint warning messages exceeds <limit value>, no further messages are issued. <extra message text> if any, is added to the standard error message.

FREQ:

Marks the start of a group of one or more <freq specifications> which have the followingformat:

567

+FREQ:

+NODE = <input node> +[MINFREQ=<freq value>] +[MAXFREQ=<freq value>] +[WHEN=<boolean expression>] +[MESSAGE="<extra message text>"] +[ERRORLIMIT=<limit value>]

The NODE argument, <input node>, defines the node whose input is to be checked for frequency.

The MINFREQ argument, <freq value>, defines the minimum permissible frequency on <input node>.

The MAXFREQ argument, <freq value>, defines the maximum permissible frequency on <input node>.

Either MINFREQ or MAXFREQ must be present in every FREQ specification.

How it works

FREQ checks compare the frequency on <input node> with <freq value>. If the frequency is greater than MAXFREQ or less than MINFREQ, the appropriate error message is issued.

WIDTH checks compare the low and high pulse widths on <input node> with <time value>. If the high pulse width is less than MIN_HI or the low pulse width is less than MIN_LO, the appropriate error message is issued.

WIDTH and FREQ checks are identical if the pulse duty cycle is exactly 50%. Otherwise, the WIDTH check is somewhat more flexible, as it allows for the possibility of asymmetric duty cycles.

The constraint is checked only if <boolean expression> is true. If the number of constraint warning messages exceeds <limit value>, no further messages are issued. <extra message text> if any, is added to the standard error message.

GENERAL:

Marks the start of a group of one or more <general specifications> which have the following format:

+GENERAL: +WHEN=<boolean expression>

568 Chapter 23: Digital Devices

+MESSAGE="<messagetext>" +ERRORLIMIT=<limit value>

How it works

When any of the CONSTRAINT inputs change, the <boolean expression> is evaluated. If the result is TRUE, then an error message containing the simulation time and the <message text> is generated.

Constraint points to remember:

Constraints may be one or many.

Constraints may occur in any order.

Constraints may be duplicated. That is, you can use more than one WIDTH or SETUP_HOLD specification.

Constraints may include <extra message text> that is appended to the standard internally generated message text.

Each constraint specification has its own ERRORLIMIT. The default value is copied from the Global Settings value of DIGERRDEFAULT. DIGERRDEFAULT, like all Global Settings values, may be overridden by using the .OPTIONS command. That is, placing the text,

.OPTIONS DIGERRDEFAULT=12

in your circuit changes the DIGERRDEFAULT value for the circuit. When more than ERRORLIMIT violations of the particular constraint check have occurred, no further messages are issued. Other constraints continue to issue messages.

• DIGERRLIMIT, from the Global Settings, is used to limit the total number of error messages from all sources.

Example

Here is an example of the CONSTRAINT used in a decade counter. Note the use of multiple WIDTH and SETUP_HOLD specifications.

Ucnstr CONSTRAINT(9) DPWR DGND

+ MRBAR PEBAR CP CEP CET D0 D1 D2 D3

569

+IO_STD

+F R E Q :

+

NODE =

CP

+

MAXFREQ

= 130MEG

+WIDTH:

+

NODE =

CP

+

MIN_HI

= 4ns

+WIDTH:

+

NODE =

MRBAR

+

MIN_LO

= 5n

+SETUP_HOLD:

+

CLOCK

LH

=

CP

+

DATA(4) = D0 D1 D2 D3

+

SETUPTIME

=

5n

+

WHEN

= {

(MRBAR != '0) }

+SETUP_HOLD:

+

CLOCK

LH

 

= CP

 

+

DATA(2)

=

CET

CEP

+

SETUPTIME_LO = 6n

+

SETUPTIME_HI = 11n

+

WHEN

=

{

(MRBAR != '0) }

+S E T U P _ H O L D :

+

CLOCK LH

=

CP

+

DATA(1)

= PEBAR

+

SETUPTIME_HI = 11ns

+

SETUPTIME_LO

= 7ns

+S E T U P _ H O L D :

+

CLOCK LH

=

CP

+

DATA(1)

=

MRBAR

+

SETUPTIME

=

5ns

570 Chapter 23: Digital Devices

Stimulus devices

Digital networks usually require stimulus devices for testing and simulation. These devices create a temporal sequence of digital states to stimulate the circuit. They are the digital equivalent of the analog sources, SIN, PULSE, USER, V, and I.

There are two types of sources. The stimulus generator (STIM), and the file stimulus (FSTIM). The STIM device uses a language of basic commands to create virtually any waveform. The FSTIM device reads its waveforms from an external file.

There is no timing model, since timing information is an inherent property of the stimulus devices.

Stimulus generator

The stimulus generator primitive provides a flexible language of commands for creating highly complex digital waveforms. Its format is as follows:

SPICE format

U<name> STIM(<width>,<format array>) +<digital power node> <digital ground node> +<node>*

+<I/O model name>] +[IO_LEVEL=<interface subckt select value> +[TIMESTEP=<stepsize>]

+<commands>*

Schematic format

PART attribute <name>

Example

C20

FORMAT attribute <format array>

571

Example

 

1111

; four binary values

COMMANDattribute <command_name>

Examples

0ns 0 ; 0 at 0ns 10ns 1 ; 1 at 10ns

I/O MODEL attribute <I/O model name>

Example

IO_STD

TIMESTEP attribute [<stepsize>]

Example 10ns

IO_LEVEL attribute <interface subckt select value>

Example 0

POWER NODE attribute <digital power node>

Example

$G_DPWR

GROUND NODE attribute <digital ground node>

Example

$G_DGND

572 Chapter 23: Digital Devices

Definitions

<width>

In a SPICE file, this is the number of signals or output nodes. For a schematic part, <width> is set when the part is enter in the Component library, so simply picking a STIM device from the Component library menu supplies this information.

<format array>

<command> statements use <value> statements to describe the output states. <format array> is an array of characters that defines the data format to be used by <value>. It is a sequence of characters which specify the number of outputs (signals) that the corresponding character in <value> represents. Each character of <value> is assumed to be a number in base 2<m>, where <m> is the corresponding character in <format array>. Each <value> has the same number of characters as <format array>. That is, if <format array> is '1111', then every <value> used in a <command> statement must have four characters also. The total number of characters in <format array> must equal <width>, and each character is chosen to reflect the data type ( 1= Binary, 3 = Octal, 4 = Hex).

<node>*

For SPICE components, this defines the output node names. For a schematic component, the nodes are acquired automatically and need no specification.

<stepsize>

The TIMESTEP argument <stepsize> defines the number of seconds per clock cycle. Transition times may be specified in clocks using the 'c' character. Actual time is the number of clocks times <stepsize>. The default value is zero.

<command_name>

This is a symbolic name for one or more commands that create a digital pattern for the source. It is usually defined in the text area of the circuit (or a library file) in the followingform:

.DEFINE <command_name> <command>*

where <command>* is a set of stimulus commands and is defined as follows:

<command>* <<time> <value>>

<LABEL=<labelname>>

<<time> GOTO <label name> <n> TIMES> <<time> GOTO <label name> UNTIL GT <value>> <<time> GOTO <label name> UNTIL GE <value>>

573

<<time> GOTO <label name> UNTIL LT <value>> <<time> GOTO <label name> UNTIL LE <value>> <<time> INCR BY <value>>

<<time> DECR BY <value>> REPEAT FOREVER REPEAT <n> TIMES ENDREPEAT

<time>

This specifies the time that the new value occurs, or that the INCR, DECR, or GOTO command is executed. <value> can be specified in two units (clocks and seconds) and in two forms (absolute and relative). To express the <time> in clocks, add the suffix 'C' to the number, as in '5C'. To express the <time> in seconds, use the suffix 'S' or none at all.

Relative time is measured from the last time. Absolute time is measured from the start of the simulation. To use relative time, prefix the plus '+' character to <time> as in '+10ns, or '+23C'.

<value>

This defines the new value for each output node as interpreted by <format array>. <value> is chosen from the binary set { 0, 1, R, F, X, Z, ? }, the octal set {0-7}, or the hex set {0-F}. The '?' character specifies a single random state of 1 or 0. RND specifies an array of random states, one for each output node.

<label name>

This identifies locations for GOTO statements. GOTO <label name> causes a jump to the statement following the 'LABEL=<label name>' statement.

<n>

This is the number of times to repeat a GOTO loop. A value of -1 creates a loop that repeats forever.

Notes

Absolute times within loops are converted to relative times based upon the last used time and the last used increment size.

GOTO labels must have been previously defined in a LABEL statement. No forward references are allowed.

Absolute time values must be in ascending order, except that the time after a GOTO may be the same as the GOTO.

574 Chapter 23: Digital Devices

When a GOTO command directs execution to the first statement following its specified label, the programs ignores the time value of this first statement.

UNTIL GT <value> means the loop executes until the node(s) value is greater than <value>. Similarly, GE means greater than or equal to, LT means less than, and LE means less than or equal to.

Stimulus generator examples

The examples that follow show how to code various waveforms. Example 1, 2, and 3 use a STIM1 (one output). Example 4 uses a STIM2 (two output). Example 5 uses a STIM8 (eight output) device.

Forschematics:

For the FORMAT and COMMAND attributes, enter the following:

Example

FORMAT

COMMAND

1

1

IN1

2

1

IN2

3

1

IN3

4

11

IN4

5

44

IN5

In the text area of the schematic, or in the grid text, or in the MCAP.INC, define the commands IN1, IN2, IN3, IN4, and IN5 as follows:

.DEFINE IN1 +0NS 1 +10NS 0 +20NS 1

.DEFINE IN2

++0NS 1

++10NS 0

++10NS 1

.DEFINE IN3

+0NS 0 +LABEL=BEGIN

++5NS 1

575

++5NS 0

++5NS GOTO BEGIN -1 TIMES

.DEFINE IN4 +LABEL=BEGIN

++0NS 00

++5NS 01

++5NS 10

++5NS 11

++5NS GOTO BEGIN -1 TIMES

.DEFINE IN5 +LABEL=BEGIN

++0NS INCR BY 01

++10NS GOTO BEGIN UNTIL GE 06

++10NS F0

++10NS F1

The digital outputs generated by these patterns are included with the SPICE examples shown in the following pages.

You can also see the patterns by running the circuit file STIMSAMP.CIR, which contains STIM sources with all of these patterns. Additional examples of stimulus commands can be found in the sample circuit STIM_DEMO.CIR.

For SPICE text files:

The following examples illustrate how to create the same patterns in SPICE files.

576 Chapter 23: Digital Devices

Соседние файлы в папке Micro-Cap v7.1.6
  • #
    06.06.20171.32 Кб60model.CNT
  • #
    06.06.201776.72 Кб62MODEL.HLP
  • #
    06.06.20173.72 Кб60NETHASP.INI
  • #
    06.06.2017450 б59os.dat
  • #
    06.06.2017545 б63READ.ME
  • #
    06.06.20173.31 Mб68RM.PDF
  • #
    06.06.2017226.69 Кб61setup.bmp
  • #
    06.06.201795 б59SETUP.INI
  • #
  • #
    06.06.201749 б60setup.lid
  • #
    06.06.20172.04 Mб60Standard.cmp