Exemplo n.º 1
0
def test_to_parchmint_v1_x(array_constraint_json):
    mlayer = Layer(layer_id="f",
                   name="f",
                   group="0",
                   layer_type=str(MINTLayerType.FLOW))
    mc1 = Component(
        ID="c1",
        entity="TEST",
        params=Params({"test-key": "test-value"}),
        layers=[mlayer],
    )
    mc2 = Component(
        ID="c2",
        entity="TEST",
        params=Params({"test-key": "test-value"}),
        layers=[mlayer],
    )
    mc3 = Component(
        ID="c3",
        entity="TEST",
        params=Params({"test-key": "test-value"}),
        layers=[mlayer],
    )
    mc4 = Component(
        ID="c4",
        entity="TEST",
        params=Params({"test-key": "test-value"}),
        layers=[mlayer],
    )

    array_constraint = ArrayConstraint(
        [
            mc1,
            mc2,
            mc3,
            mc4,
        ],
        2,
        1,
        500,
        500,
    )

    assert array_constraint.to_parchmint_v1_x() == array_constraint_json
Exemplo n.º 2
0
def test_to_parchmint_v1_x(orientation_constraint_json):
    mlayer = Layer(
        layer_id="f", name="f", group="0", layer_type=str(MINTLayerType.FLOW)
    )
    mc1 = Component(
        ID="c1",
        entity="TEST",
        params=Params({"test-key": "test-value"}),
        layers=[mlayer],
    )
    mc2 = Component(
        ID="c2",
        entity="TEST",
        params=Params({"test-key": "test-value"}),
        layers=[mlayer],
    )
    mc3 = Component(
        ID="c3",
        entity="TEST",
        params=Params({"test-key": "test-value"}),
        layers=[mlayer],
    )
    mc4 = Component(
        ID="c4",
        entity="TEST",
        params=Params({"test-key": "test-value"}),
        layers=[mlayer],
    )

    orientation_constraint = OrientationConstraint()
    orientation_constraint.add_component_orientation_pair(
        mc1, ComponentOrientation.HORIZONTAL
    )
    orientation_constraint.add_component_orientation_pair(
        mc2, ComponentOrientation.VERTICAL
    )
    orientation_constraint.add_component_orientation_pair(
        mc3, ComponentOrientation.HORIZONTAL
    )
    orientation_constraint.add_component_orientation_pair(
        mc4, ComponentOrientation.VERTICAL
    )

    assert orientation_constraint.to_parchmint_v1_x() == orientation_constraint_json
Exemplo n.º 3
0
 def __init__(self, name: str, port_number: int, layer: Layer) -> None:
     # super(MINTTerminal, self).__init__(name, "TERMINAL", {}, [layer])
     self._component = Component(
         ID=name,
         name=name,
         layers=[layer],
         ports_list=[Port(label="1", layer="FLOW", x=0, y=0)],
         entity="TERMINAL",
     )
     self.__port_number = port_number
Exemplo n.º 4
0
def test_to_parchmint_v1_x(mirror_constraint_json):

    mlayer = Layer(layer_id="f",
                   name="f",
                   group="0",
                   layer_type=str(MINTLayerType.FLOW))
    mc1 = Component(
        ID="c1",
        entity="TEST",
        params=Params({"test-key": "test-value"}),
        layers=[mlayer],
    )
    mc2 = Component(
        ID="c2",
        entity="TEST",
        params=Params({"test-key": "test-value"}),
        layers=[mlayer],
    )
    mc3 = Component(
        ID="c3",
        entity="TEST",
        params=Params({"test-key": "test-value"}),
        layers=[mlayer],
    )
    mc4 = Component(
        ID="c4",
        entity="TEST",
        params=Params({"test-key": "test-value"}),
        layers=[mlayer],
    )

    mc_source = Component(
        ID="source",
        entity="TEST",
        params=Params({"test-key": "test-value"}),
        layers=[mlayer],
    )

    mirror_constraint = MirrorConstraint(mc_source, 2,
                                         [[mc1, mc2], [mc3, mc4]])

    assert mirror_constraint_json == mirror_constraint.to_parchmint_v1_x()
Exemplo n.º 5
0
def test_to_parchmint_v1_x(rotation_constraint_json):
    mlayer = Layer("f", "f", "0", str(MINTLayerType.FLOW))

    mc_source = Component(
        ID="source",
        entity="TEST",
        params=Params({"test-key": "test-value"}),
        layers=[mlayer],
    )
    rotation_constraint = RotationConstraint(mc_source, 90)
    assert rotation_constraint.to_parchmint_v1_x() == rotation_constraint_json
Exemplo n.º 6
0
def test_to_parchmint_v1_x(orthogonal_constraint_json):
    mlayer = Layer(layer_id="f",
                   name="f",
                   group="0",
                   layer_type=str(MINTLayerType.FLOW))
    mc1 = Component(
        ID="c1",
        entity="TEST",
        params=Params({"test-key": "test-value"}),
        layers=[mlayer],
    )
    mc2 = Component(
        ID="c2",
        entity="TEST",
        params=Params({"test-key": "test-value"}),
        layers=[mlayer],
    )
    mc3 = Component(
        ID="c3",
        entity="TEST",
        params=Params({"test-key": "test-value"}),
        layers=[mlayer],
    )
    mc4 = Component(
        ID="c4",
        entity="TEST",
        params=Params({"test-key": "test-value"}),
        layers=[mlayer],
    )

    mc_source = Component(
        ID="source",
        entity="TEST",
        params=Params({"test-key": "test-value"}),
        layers=[mlayer],
    )

    orthogonal_constraint = OrthogonalConstraint(
        [mc_source, mc1, mc2, mc3, mc4])
    assert orthogonal_constraint.to_parchmint_v1_x(
    ) == orthogonal_constraint_json
Exemplo n.º 7
0
def test_to_component_MINT(params_dict, layer):
    """
    Test that the Component class can be converted to a MINT
    """
    component = Component(name="c1",
                          ID="c1",
                          entity="TEST",
                          params=Params(params_dict),
                          layers=[layer])
    params_string = ""
    for param in params_dict:
        params_string += param + "=" + str(params_dict[param]) + " "
    assert to_component_MINT(component) == "TEST c1 {};".format(params_string)
Exemplo n.º 8
0
    def __init__(self, name: str, layer: Layer) -> None:
        """Creates a new NODE object

        Args:
            name (str): name of the node
            layer (str, optional): [description].
        """
        self._component = Component(
            name=name,
            ID=name,
            layers=[layer],
            ports_list=[Port(label="1", layer="FLOW", x=0, y=0)],
            xspan=0,
            yspan=0,
            entity="NODE",
        )
Exemplo n.º 9
0
def test_to_parchmint_v1_x(position_constraint_json):
    mlayer = Layer(layer_id="f",
                   name="f",
                   group="0",
                   layer_type=str(MINTLayerType.FLOW))

    mc_source = Component(
        ID="source",
        entity="TEST",
        params=Params({"test-key": "test-value"}),
        layers=[mlayer],
    )

    position_constraint = PositionConstraint(mc_source, 500, 500, 500)

    assert position_constraint.to_parchmint_v1_x() == position_constraint_json
Exemplo n.º 10
0
    def __init__(self,
                 name: str,
                 layers: List[Layer],
                 width: float = 0) -> None:
        """Creates a new instance of a Via

        Args:
            name (str): name/ID of the via
            layers (List[MINTLayer]): List of layer objects where the via is present
        """
        self._component: Component = Component(
            name=name,
            ID=name,
            entity="VIA",
            layers=layers,
            params=Params(),
            xspan=0,
            yspan=0,
            ports_list=[Port(label="1", layer="FLOW", x=0, y=0)],
        )

        self._component.params.set_param("width", width)
Exemplo n.º 11
0
    def create_mint_component(
        self, name: str, technology: str, params: Dict, layer_ids: List[str]
    ) -> Component:
        """Creates a new component and adds it to the device

        Args:
            name (str): name
            technology (str): MINT string
            params (Dict): params dictionary
            layer_ids (List[str]): list of layer ids

        Returns:
            Component: the newly created component
        """
        # Retrieve the correct layer:
        layers = []
        for layer_id in layer_ids:
            layers.append(self._device.get_layer(layer_id))
        component = Component(
            name=name, ID=name, layers=layers, params=Params(params), entity=technology
        )
        self._device.add_component(component)
        return component
Exemplo n.º 12
0
def test_component_to_parchmint_v1_x_dict(params_dict, layer_dict, port_dict,
                                          component_dict):
    layer = Layer(layer_dict)
    component = Component()
    component.name = "c1"
    component.ID = "c1"
    component.params = Params(params_dict)
    component.entity = "MIXER"
    component.layers.append(layer)
    component.add_component_port(Port(port_dict))
    component.xspan = 1000
    component.yspan = 5000
    # Test to see if the component dict is correct or not
    assert component.to_parchmint_v1() == component_dict

    # Test to see if the loading from dictionary is working correctly
    # Create dummy device to get the layer id from
    device = Device()
    device.layers.append(layer)
    component = Component(json_data=component_dict, device_ref=device)
    assert component.to_parchmint_v1() == component_dict
Exemplo n.º 13
0
def component_for_rotation():
    component = Component()
    component.name = "c1"
    component.ID = "c1"
    component.entity = "MIXER"
    component.xspan = 1000
    component.yspan = 15000
    top_port = Port()
    top_port.label = "top"
    top_port.x = int(component.xspan / 2)
    top_port.y = 0
    bottom_port = Port()
    bottom_port.label = "bottom"
    bottom_port.x = int(component.xspan / 2)
    bottom_port.y = component.yspan
    component.add_component_port(top_port)
    component.add_component_port(bottom_port)

    return component