Pattern

class decida.Pattern.Pattern(**kwargs)

Bases: decida.ItclObjectx.ItclObjectx

synopsis:

Pattern generator.

Pattern generates one of various bit-sequences and outputs the sequence as either a string of 1’s and 0’s, a piece-wise linear set of time, voltage pairs, or a set of time, binary pairs.

The Tckt class uses Pattern to generate piece-wise linear voltage specifications for procedural simulation scripts.

constructor arguments:

**kwargs (dict)

keyword=value specifications: configuration-options

configuration options:

v0 (float, default=0.0)

low value of the signal.

v1 (float, default=1.0)

high value of the signal.

delay (float, default=0.0)

delay before first bit.

edge (float, default=50ps)

rise and fall times in s.

period (float, default=1ns)

bit period in s.

pre (str, default=””)

specify preamble to bit-pattern (bit-sequence)

post (str, default=””)

specify suffix to bit-pattern (bit-sequence)

start_at_first_bit (bool, default=False)

Normally a pwl sequence starts at the common-mode. If start_at_first_bit=True, start at first bit value.

format (str, default=”pwl”)

Format of return list:

“binary”: return pattern only

“time-binary”: return list of time binary pairs

“pwl”: return piecewise linear waveform

example (from test_Pattern):

from decida.Pattern import Pattern

p = Pattern(delay=4e-9, start_at_first_bit=True, edge=0.1e-9)
pwl = p.prbs(length=50)
print "t v"
for t,v in zip(pwl[0::2], pwl[1::2]) :
    print t, v

public methods:

  • public methods from ItclObjectx
clock(length, startbit=0, bits_level=1)

generate clock pattern (0, 1, 0, 1, 0, ...).

arguments:

length (int)

The number of bits in the sequence

startbit (int, default=0)

The starting bit of the bit sequence

bits_level (int, default=1)

Number of bits in each clock level.

results:

  • The Pattern pattern is set to a clock pattern, with the start bit set to the specified value.
  • Returns pattern in format specified by the format configuration option.
format(pattern)

format the bit-sequence.

arguments:

pattern (string)

a string of “1“‘s and “0“‘s

results:

  • Returns Pattern pattern in format specified by the format configuration option.

    format is one of:

    • “binary”: string sequence of “1“‘s and “0“‘s
    • “time-binary”: pairs of time, and integer value 1 or 0.
    • “pwl”: pairs of time, value to account for signal edge, period, and voltage low and high values.
long_short(long, short, startbit=0, length=0)
generate a bit pattern with several repeated bits, followed by
a phase where each bit is inverted.

arguments:

long (int)

number of bits in the long phase, where each bit is repeated.

short (int)

number of bits in the short phase, where each bit is inverted.

startbit (int, default=0)

The starting bit of the bit sequence

length (int, default=0)

The number of bits in the sequence. If not specified, or less than 1, set to long+short

results:

  • The Pattern pattern is set to the bit pattern.
  • Returns pattern in format specified by the format configuration option.
pattern(pattern)

specify and generate a bit pattern directly.

arguments:

pattern (str)

a string of “1“‘s and “0“‘s

results:

  • The Pattern pattern is set to the bit pattern.
  • Returns pattern in format specified by the format configuration option.
prbs(size=7, length=0)

generate a pseudo-random bit pattern.

arguments:

size (int, default=7)

The PRBS specification: size=7 generates a pseudo-random bit-sequence of length 2^7-1.

length (int, default=0)

The length of the bit-sequence. If length=0, generates a sequence of 2^size - 1.

results:

  • The Pattern pattern is set to the PRBS bit pattern.
  • Returns pattern in format specified by the format configuration option.
rand(length, seed=None)

generate a random bit sequence.

arguments:

length (int)

the length of the bit sequence.

seed (str, default=None)

random seed to initialize random number generator.

results:

  • The Pattern pattern is set to a random bit pattern.
  • Returns pattern in format specified by the format configuration option.