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')-
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)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".
Ancestors
Methods
def get_generate_wire(self)-
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)Get output wire carrying generate signal value.
Returns
Wire- Return generate wire.
def get_propagate_wire(self)-
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)Get output wire carrying propagate signal value.
Returns
Wire- Return propagate wire.
Inherited members
FourInputOneBitCircuit:add_componentget_blif_code_flatget_blif_code_hierget_c_code_flatget_c_code_hierget_cgp_code_flatget_circuit_blifget_circuit_cget_circuit_defget_circuit_gatesget_circuit_vget_circuit_wire_indexget_circuit_wiresget_component_typesget_declaration_blifget_declaration_c_flatget_declaration_c_hierget_declaration_v_flatget_declaration_v_hierget_declarations_c_hierget_declarations_v_flatget_declarations_v_hierget_function_blif_flatget_function_block_blifget_function_block_cget_function_block_vget_function_blocks_blifget_function_blocks_cget_function_blocks_vget_function_out_blifget_function_out_c_flatget_function_out_c_hierget_function_out_python_flatget_function_out_v_flatget_function_out_v_hierget_hier_subcomponent_defget_includes_cget_init_c_flatget_init_c_hierget_init_python_flatget_init_v_flatget_init_v_hierget_instance_numget_invocation_blif_hierget_invocations_blif_hierget_multi_bit_componentsget_one_bit_componentsget_out_invocation_cget_out_invocation_vget_outputs_cgpget_parameters_cgpget_previous_componentget_prototype_blifget_prototype_cget_prototype_pythonget_prototype_vget_prototype_v_hierget_python_code_flatget_self_init_v_flatget_self_init_v_hierget_triplets_cgpget_unique_typesget_v_code_flatget_v_code_hiersave_wire_id