pub struct Primitive {
    pub name: Id,
    pub params: Vec<Id, Global>,
    pub signature: Vec<PortDef<Width>, Global>,
    pub attributes: Attributes,
    pub is_comb: bool,
    pub latency: Option<NonZeroU64>,
    pub body: Option<String>,
}
Expand description

Representation of a external primitive definition.

Example

primitive std_reg<"static"=1>[WIDTH](
  in: WIDTH, write_en: 1, clk: 1
) -> (
  out: WIDTH, done: 1
);

The signature of a port is represented using PortDef which also specify the direction of the port.

Fields

name: Id

Name of this primitive.

params: Vec<Id, Global>

Paramters for this primitive.

signature: Vec<PortDef<Width>, Global>

The input/output signature for this primitive.

attributes: Attributes

Key-value attributes for this primitive.

is_comb: bool

True iff this is a combinational primitive

latency: Option<NonZeroU64>

(Optional) latency; for static primitives

body: Option<String>

body of the string, if it is an inlined primitive

Implementations

Retuns the bindings for all the paramters, the input ports and the output ports.

Return all ports that have the attribute attr.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Return a reference to the object’s name

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.