Module ariths_gen.one_bit_circuits.one_bit_components.four_input_one_bit_components
Classes
class BlackCell (a: Wire = <ariths_gen.wire_components.wires.Wire object>,
b: Wire = <ariths_gen.wire_components.wires.Wire object>,
c: Wire = <ariths_gen.wire_components.wires.Wire object>,
d: Wire = <ariths_gen.wire_components.wires.Wire object>,
prefix: str = '',
name: str = 'bc')-
Class representing four input black cell used in parallel prefix adders inside the PG (parallel prefix computation) logic.
Black cell is based on a notation used in the book CMOS VLSI Design (please refer to the book for more details not deducible from the code itself).
┌──────┐ ───►│ ├─► Generate ───►│ │ ───►│ │ ───►│ ├─► Propagate └──────┘
Description of the init method.
Args
a
:Wire
, optional- First input wire, represents generate signal from the current stage. Defaults to Wire(name="g1").
b
:Wire
, optional- Second input wire, represents propagate signal from the current stage. Defaults to Wire(name="p1").
c
:Wire
, optional- Third input wire, represents generate signal from a preceding stage. Defaults to Wire(name="g0").
d
:Wire
, optional- Fourth input wire, represents propagate signal from a preceding stage. Defaults to Wire(name="p0").
prefix
:str
, optional- Prefix name of grey cell. Defaults to "".
name
:str
, optional- Name of grey cell. Defaults to "gc".
Expand source code
class BlackCell(FourInputOneBitCircuit): """Class representing four input black cell used in parallel prefix adders inside the PG (parallel prefix computation) logic. Black cell is based on a notation used in the book CMOS VLSI Design (please refer to the book for more details not deducible from the code itself). ``` ┌──────┐ ───►│ ├─► Generate ───►│ │ ───►│ │ ───►│ ├─► Propagate └──────┘ ``` Description of the __init__ method. Args: a (Wire, optional): First input wire, represents generate signal from the current stage. Defaults to Wire(name="g1"). b (Wire, optional): Second input wire, represents propagate signal from the current stage. Defaults to Wire(name="p1"). c (Wire, optional): Third input wire, represents generate signal from a preceding stage. Defaults to Wire(name="g0"). d (Wire, optional): Fourth input wire, represents propagate signal from a preceding stage. Defaults to Wire(name="p0"). prefix (str, optional): Prefix name of grey cell. Defaults to "". name (str, optional): Name of grey cell. Defaults to "gc". """ def __init__(self, a: Wire = Wire(name="g1"), b: Wire = Wire(name="p1"), c: Wire = Wire(name="g0"), d: Wire = Wire(name="p0"), prefix: str = "", name: str = "bc"): super().__init__(a, b, c, d, prefix=prefix, name=name) # 2 wires for component's bus output (generate, propagate) self.out = Bus(self.prefix+"_out", 2) # Create/propagate the generate signal self.add_component(AndGate(a=self.b, b=self.c, prefix=self.prefix+"_and"+str(self.get_instance_num(cls=AndGate)), parent_component=self)) self.add_component(OrGate(a=self.a, b=self.get_previous_component().out, prefix=self.prefix+"_or"+str(self.get_instance_num(cls=OrGate)), parent_component=self)) # Connection of the generate output wire self.out.connect(0, self.get_previous_component().out) # Create/propagate the propagate signal self.add_component(AndGate(a=self.b, b=self.d, prefix=self.prefix+"_and"+str(self.get_instance_num(cls=AndGate)), parent_component=self)) # Connection of the propagate output wire self.out.connect(1, self.get_previous_component().out) def get_generate_wire(self): """Get output wire carrying generate signal value. Returns: Wire: Return generate wire. """ return self.out.get_wire(0) def get_propagate_wire(self): """Get output wire carrying propagate signal value. Returns: Wire: Return propagate wire. """ return self.out.get_wire(1)
Ancestors
Methods
def get_generate_wire(self)
-
Get output wire carrying generate signal value.
Returns
Wire
- Return generate wire.
Expand source code
def get_generate_wire(self): """Get output wire carrying generate signal value. Returns: Wire: Return generate wire. """ return self.out.get_wire(0)
def get_propagate_wire(self)
-
Get output wire carrying propagate signal value.
Returns
Wire
- Return propagate wire.
Expand source code
def get_propagate_wire(self): """Get output wire carrying propagate signal value. Returns: Wire: Return propagate wire. """ return self.out.get_wire(1)
Inherited members
FourInputOneBitCircuit
:add_component
get_blif_code_flat
get_blif_code_hier
get_c_code_flat
get_c_code_hier
get_cgp_code_flat
get_circuit_blif
get_circuit_c
get_circuit_def
get_circuit_gates
get_circuit_v
get_circuit_wire_index
get_circuit_wires
get_component_types
get_declaration_blif
get_declaration_c_flat
get_declaration_c_hier
get_declaration_v_flat
get_declaration_v_hier
get_declarations_c_hier
get_declarations_v_flat
get_declarations_v_hier
get_function_blif_flat
get_function_block_blif
get_function_block_c
get_function_block_v
get_function_blocks_blif
get_function_blocks_c
get_function_blocks_v
get_function_out_blif
get_function_out_c_flat
get_function_out_c_hier
get_function_out_python_flat
get_function_out_v_flat
get_function_out_v_hier
get_hier_subcomponent_def
get_includes_c
get_init_c_flat
get_init_c_hier
get_init_python_flat
get_init_v_flat
get_init_v_hier
get_instance_num
get_invocation_blif_hier
get_invocations_blif_hier
get_multi_bit_components
get_one_bit_components
get_out_invocation_c
get_out_invocation_v
get_outputs_cgp
get_parameters_cgp
get_previous_component
get_prototype_blif
get_prototype_c
get_prototype_python
get_prototype_v
get_prototype_v_hier
get_python_code_flat
get_self_init_v_flat
get_self_init_v_hier
get_triplets_cgp
get_unique_types
get_v_code_flat
get_v_code_hier
save_wire_id