Hardcaml.CyclesimSourceCycle accurate simulator
Read and write access for memories. They have much the same API as Nodes. and Regs except for an extra address argument.
base type of the cycle based simulators
returns the circuit used to compile the simulation.
update combinatorial logic before clock edge and relative to new inputs.
update sequential logic - registers and memories.
get input port given a name
Signals and their unique (mangled) names to be traced by the simulation. Includes both IO ports and internal signals - the latter are accessible via the lookup function.
Get output port given a name. If clock_edge is Before the outputs are computed prior to the clock edge - After means the outputs are computed after the clock edge.
Current value of an internal (combinational) node within the simulator.
Peek at internal registers, return Some _ if it's present. Note that the node must marked as traced in Cyclesim.Config.t when creating simulations for this to return (Some _). Writing to the Bits.Mutable.t will change the simulation internal node's value and affect the results of simulation.
Similar to lookup_data, but for memories. This is very useful for initializing memory contents without having to simulate the entire circuit.
construct a simulator from a circuit
val combine :
?port_sets_may_differ:Base.bool ->
?on_error:(Combine_error.t -> Base.unit) ->
('i, 'o) t ->
('i, 'o) t ->
('i, 'o) tCombine 2 simulators. The inputs are set on the 1st simulator and copied to the 2nd. Outputs are checked and on_error is called if a difference is found. By default, on_error raises.
The simulators should have the same input and output port sets, unless port_sets_may_differ is true, in which case only ports which exist on both simulators are checked.