123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222openBasemoduletypeNames=sigtypet(** Returns the list of names assigned to the signal. *)valnames:t->stringlist(** Set the given names on the signal. Wipes any names currently set. *)valset_names:t->stringlist->unitendmoduletypeAttributes=sigtypet(** Add an attribute to node. This is currently supported only in Verilog. *)valadd_attribute:t->Rtl_attribute.t->t(** Returns attributes associated to the signal. *)valattributes:t->Rtl_attribute.tlist(** Set the format used to display the signal *)val(--$):t->Wave_format.t->tendmoduletypeComments=sigtypet(** Set the comment associated with the signal. This is currently only supported in
Verilog. *)valset_comment:t->string->t(** Remove the comment associated with the signal. This is currently only supported in
Verilog. *)valunset_comment:t->t(** Returns comment associated with the signal. *)valcomment:t->stringoptionendmoduletypePorts=sigtypet(** Creates an input. *)valinput:string->int->t(** Creates an output. *)valoutput:string->t->tendmoduletypeWires=sigtypet(** Creates an unassigned wire. *)valwire:int->t(** Creates an assigned wire. *)valwireof:t->t(** Assigns to wire. *)val(<==):t->t->unitvalassign:t->t->unitendmoduletypeLogic=sigtypet(** Combinational logic API with constant propogation optimizations. *)includeComb.Swithtypet:=t(** Combinational logic API without constant propogation optimizations. *)moduleUnoptimized:Comb.Swithtypet:=tendmoduletypeRegs=sigtypetvalreg:Reg_spec.t->?enable:t->t->tvalreg_fb:?enable:t->Reg_spec.t->width:int->f:(t->t)->t(** Pipeline a signal [n] times with the given register specification. If set, a list of
RTL attributes will also be applied to each register created. *)valpipeline:?attributes:Rtl_attribute.tlist->Reg_spec.t->n:int->?enable:t->t->tendmoduletypeMemories=sigtypetvalmultiport_memory:?name:string->?attributes:Rtl_attribute.tlist->int->write_ports:tWrite_port.tarray->read_addresses:tarray->tarrayvalmemory:int->write_port:tWrite_port.t->read_address:t->tvalram_wbr:?name:string->?attributes:Rtl_attribute.tlist->write_port:tWrite_port.t->read_port:tRead_port.t->int->tvalram_rbw:?name:string->?attributes:Rtl_attribute.tlist->write_port:tWrite_port.t->read_port:tRead_port.t->int->tendmoduletypeSignal=sig(** Signal type for constructing logic designs. *)typet=Signal__type.tmoduleType=Signal__type(** {1 Naming}
One or more string names applied to a signal. These will be used during RTL code
generation and simulation to aid design inspection. *)includeNameswithtypet:=t(** {1 Attributes}
Attributes are attached to signals and written during RTL generation. They can be
used to control downstream synthesis and place and route tools. They do not
otherwise affect the Hardcaml circuit. *)includeAttributeswithtypet:=t(** {1 Comments}
A comment can be associated with a signal, and this is sometimes useful to pass
information to downstream tooling (specifically Verilator). *)includeCommentswithtypet:=t(** {1 Circuit Input and Output Ports}
Specification of the module level input and output ports. Ports are represented in
Hardcaml as wires with a single name. Note that Hardcaml will generally rewrite and
legalize names depending on context but will not do so for ports. *)includePortswithtypet:=t(** {1 Wires}
Wires are used in Hardcaml to conenct two signals together. They are first created
then assigned to (internally they have a mutable reference to their driver). Wires
are how we can create cycles which we require in order to build logic like, for
example, a counter.
It is entirely possible to create combinational loops using wires. Often this is
not the intent and Hardcaml has functions to detect this - for example, Cyclesim
will fail if there is such a loop.
*)includeWireswithtypet:=t(** {1 Combinational Logic}
The main combinational logic API for creating things like adders, multiplexers etc.
This API is the same as provided by [Bits.t].
By default Hardcaml performs constant propogation over signals - operations with
purely constant values (and some other simple cases such as [a &: vdd]) will be
simplified. You can avoid this by using the operations from the [Unoptimized]
module. *)includeLogicwithtypet:=t(** {1 Registers}
Registers are configured using a [Reg_spec.t]. This encodes the clock, synchronous
clear, and asychronous reset used. *)includeRegswithtypet:=t(** {1 Memories}
[multiport_memory] provides the low-level primitive from which Hardcaml memories
are created. It provides a memory with an arbitrary number of read and write ports
that is asychronously read.
By default synthesizers will infer either LUT ram or register banks from this
primitive.
Limiting the number of read/write ports and placing a register on the read address
or read output port will allow synthesizers to infer single or simple dual port RAM
from RTL. [ram_rbw] and [ram_wbr] are examples of this. *)includeMemorieswithtypet:=t(** Pretty printer. *)valpp:Formatter.t->t->unit(**/**)(* The following are exposed for convenience. They are also available under [Types].*)(** Returns the unique id of the signal. *)valuid:t->Type.Uid.t(** Returns the list of names assigned to the signal. *)valnames:t->stringlistmoduleUid=Type.Uidend