elements
ResetPulse
Bases: Leaf
Create a single step waveform (useful for Reset signals)
Examples:
This will use the settings in tech.yml for timing of step.
Move step to 5n and complete step after 0.5n
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Name for the voltage source subcircuit instance |
required |
Other Parameters:
Name | Type | Description |
---|---|---|
slope |
float
|
0-100% time in ns |
deassert_time |
float
|
When to create the step |
Attributes:
Name | Type | Description |
---|---|---|
node |
Port
|
Where the reset pulse is connected |
p |
(SupplyPort
|
Source code in circuitbrew/elements.py
Supply
Bases: Module
Instantiate the full supply for vdd and gnd as a sub-circuit.
Examples:
>>> self.vdd_supply = Supply(name='vdd', voltage=self.sim_setup['voltage'])
p = self.vdd_supply.p
vdd = p.vdd
gnd = p.gnd
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Name for the voltage source subcircuit instance |
required | |
voltage |
Voltage level ('1.8V', '750mV', etc) |
required | |
measure |
Whether to measure power or not |
True
|
Other Parameters:
Name | Type | Description |
---|---|---|
p |
SupplyPort, Optional
|
The port to connect to |
Source code in circuitbrew/elements.py
VerilogBucket
Bases: VerilogParameterizedModule
A single-bit bucket module that sinks values on every clk edge and checks them against the expected values. If the user didn't specify the expected values, then the sim model method will provide the values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
values |
list[int]
|
sequence of values to check against |
None
|
Other Parameters:
Name | Type | Description |
---|---|---|
clk |
InputPort
|
input clock signal |
_reset |
InputPort
|
only starts checking when deasserted |
d |
InputPort
|
input values |
Attributes:
Name | Type | Description |
---|---|---|
values |
the sequence of values to check against |
Source code in circuitbrew/elements.py
sim()
async
If self.values already exists, then do nothing.
Otherwise, receive values on d, and append them to self.values
Source code in circuitbrew/elements.py
VerilogClock
Bases: VerilogModule
Create a clock with the specified frequency and offset
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Name of object |
required |
freq |
float
|
Frequency of clock in Hz |
required |
offset |
float
|
Start of clock waveform from 0n (ns) |
0
|
Other Parameters:
Name | Type | Description |
---|---|---|
enable |
InputPort
|
active-high enable signal |
clk |
OutputPort
|
the output clock signal |
Source code in circuitbrew/elements.py
VerilogModule
Bases: Module
Any Module class that depends on a Verilog-A/Verilog code inside a template file can subclass this. It will automatically copy the template file to the output directory.
If you have a subclass that needs parameters (for example, a Source module might need to inject a series of different values into the templated verilog file, thereby creating a different verilog file each time it's instanced), then you should use the circuitbrew.elements.VerilogParameterizedModule below.
Source code in circuitbrew/elements.py
_emit_src_file(src_filename, param_dict={}, out_filename=None)
Call this at the end of your get_spice
method.
Need to fix this to not use deprecated pkg_resources.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
src_filename |
str
|
The template file (Mako) |
required |
param_dict |
dict
|
The template variables to fill in |
{}
|
out_filename |
str
|
If you want to use a different name for the output template file. If you leave unspecified, then it will use the src_filename in the output directory |
None
|
Returns:
Name | Type | Description |
---|---|---|
out_filename |
str
|
The output file |
Source code in circuitbrew/elements.py
_write_file(filename, contents)
Write out the filename to the output directory in sim_setup['output_dir']
.
Optionally create that directory if it doesn't exist
Source code in circuitbrew/elements.py
get_spice(param_dict={})
You usually don't need to override this method. You can add whatever custom parameters to the param_dict in your subclass before calling its super().get_spice() method.
The parametrized modules are a notable exception to this. See circuitbrew.elements.VerilogParameterizedModule.get_spice
Source code in circuitbrew/elements.py
VerilogParameterizedModule
Bases: ParameterizedModule
, VerilogModule
For any verilog-a/verilog module that we need to uniquify the template file.
Source code in circuitbrew/elements.py
get_spice(param_dict={})
Specialized version to make sure we change the output filename for every instance of this class
Source code in circuitbrew/elements.py
VerilogSrc
Bases: VerilogParameterizedModule
, SourceModule
A single-bit source module that takes a list of values and outputs them on every clock edge.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
values |
list[int]
|
sequence of values to output |
required |
Other Parameters:
Name | Type | Description |
---|---|---|
clk |
InputPort
|
input clock signal |
_reset |
InputPort
|
only starts outputting when deasserted |
d |
OutputPort
|
output values |
Source code in circuitbrew/elements.py
VoltageSource
Bases: Leaf
Emits a voltage source with ref to global '0'. If you're trying to define the system global voltage supply, then I recommend using instead circuitbrew.elements.Supply which instantiates this module and gives you access to vdd and gnd as a circuitbrew.compound_ports.SupplyPort
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Name for the voltage source subcircuit instance |
required |
voltage |
str
|
Voltage level ('1.8V', '750mV', etc) |
required |
measure |
bool
|
Whether to measure power or not (not implemented) |
False
|
Other Parameters:
Name | Type | Description |
---|---|---|
node |
Port
|
The node to apply the voltage to |