Documentation
¶
Overview ¶
Package sim provides simulation capabilities.
sim.T is a simulator which implicitly parallelizes Boolean operations by doing 64 independent simulation steps per logic gate in one 64 bit word bitwise operation.
Interfaces are provided for watches and monitoring.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct { M z.Lit // a watch I int // which trace in [0..64) V []uint64 // evaluations W [][]uint64 // window WI int // index of next values in window. N int64 // how many steps. T *reach.Trace // trace or partial trace. F EventFlag // what flags were set. }
Event gives the context of an event in a simulation.
type EventFlag ¶
type EventFlag int
EventFlag says what event info to send back
const ( // FlagWait tells the simulator to continue if the listener is not ready to // receive. FlagWait EventFlag = 1 << iota // FlagRoundTrip tells the simulator to to ask for the event back after it // was sent. When it receives the event, it updates the flags. This can be // used to pause the simulation. FlagRoundTrip // FlagCopyV tells the simulator to copy the values. FlagCopyV // FlagCopyW tells the simulator to copy the window. FlagCopyW // FlagStop tells the simulator to stop. It is only used in the case // FlagRoundTrip is set. FlagStop // FlagTrace tells the simulator to generate a trace for the watch. Only // the first trace is generated. FlagTrace )
type Options ¶
type Options struct { // MaxDepth to which to simulate (unless RestartFactor is non-zero). MaxDepth int64 // The max duration of a simulation. Duration time.Duration // Stop if every watch has been positive WatchUntil times. WatchUntil int // The random Seed Seed int64 // N is the number of simulations to run, default 1. N int // TraceWindow give the max size of a trace (window of simulation memory), default 128. TraceWindow int // RestartFactor, given a function k=f(n) telling us to restart the n'th time // after k steps, run RestartFactor*k steps. f is the Luby Series. RestartFactor int // GenTrace whether to generate a trace. GenTrace bool // log events Verbose bool // Events, ignored if EventChan is nil EventFlags EventFlag // EventChan is a channel on which to communicate simulation events. EventChan chan *Event }
Options provides configuration info for the simulutor.
type T ¶
type T struct {
// contains filtered or unexported fields
}
T holds state for a simulator.
func (*T) FillOutput ¶
FillOutput fills `out` with the results of the last simulation.
func (*T) SetOptions ¶
Click to show internal directories.
Click to hide internal directories.