#!/usr/bin/python3
# This file was automatically generated from drawio2CBD from
#   .\LCG.drawio

from pyCBD.Core import *
from pyCBD.lib.std import *
from pyCBD.lib.endpoints import SignalCollectorBlock

class LCG(CBD):
    def __init__(self, block_name, x0=(0), a=(1), c=(4), m=(9)):
        super().__init__(block_name, input_ports=[], output_ports=[])

        # Create the Blocks
        self.addBlock(ConstantBlock("a", value=(a)))
        self.addBlock(ConstantBlock("x0", value=(x0)))
        self.addBlock(ConstantBlock("c", value=(c)))
        self.addBlock(ConstantBlock("m", value=(m)))
        self.addBlock(DelayBlock("delay"))
        self.addBlock(ProductBlock("mult", numberOfInputs=(2)))
        self.addBlock(AdderBlock("sum", numberOfInputs=(2)))
        self.addBlock(ModuloBlock("mod"))
        self.addBlock(SignalCollectorBlock("collector"))

        # Create the Connections
        self.addConnection("x0", "delay", output_port_name="OUT1", input_port_name="IC")
        self.addConnection("a", "mult", output_port_name="OUT1", input_port_name="IN1")
        self.addConnection("delay", "mult", output_port_name="OUT1", input_port_name="IN2")
        self.addConnection("mult", "sum", output_port_name="OUT1", input_port_name="IN1")
        self.addConnection("c", "sum", output_port_name="OUT1", input_port_name="IN2")
        self.addConnection("m", "mod", output_port_name="OUT1", input_port_name="IN2")
        self.addConnection("sum", "mod", output_port_name="OUT1", input_port_name="IN1")
        self.addConnection("mod", "delay", output_port_name="OUT1", input_port_name="IN1")
        self.addConnection("mod", "collector", output_port_name="OUT1", input_port_name="IN1")


