示例#1
0
	def __init__(self, memoryFile):
		self.nCycles = 0 # Used to hold number of clock cycles spent executing instructions

		# Fetch
		self.PCMux	  = Mux()
		self.ProgramC   = PC(long(0xbfc00200))
		self.InstMem	= InstructionMemory(memoryFile)
		self.IFadder	= Add()
		self.JMux	   = Mux()
		self.IFaddconst = Constant(4)
		self.IF_ID_Wall = Wall()
		self.fetchgroup = {}

		# Decode
		self.register   = RegisterFile()
		self.signext	= SignExtender()
		self.control	= ControlElement()
		self.jmpCalc	= JumpCalc()
		self.ID_EX_Wall = Wall()

		# Execute
		self.EXadder	= Add()
		self.shiftL	 = LeftShifter()
		self.ALogicUnit = ALU()
		self.ALUSrcMux  = Mux()
		self.RegDstMux  = Mux()
		self.ALUctrl	= AluControl()
		self.EX_MEM_Wall= Wall()

		# Memory
		self.storage	= DataMemory(memoryFile)
		self.brnch	  = Branch()
		self.MEM_WB_Wall= Wall()

		# Write Back
		self.WBmux = Mux()

		self.ProgramC
		self.elements1 = [self.InstMem, self.IFaddconst, self.IFadder, self.PCMux, self.JMux]
		self.elements2 = [self.control, self.register, self.signext, self.jmpCalc]
		self.elements3 = [self.shiftL, self.ALUSrcMux, self.RegDstMux, self.ALUctrl, self.ALogicUnit, self.EXadder]
		self.elements4 = [self.brnch, self.storage]
		self.elementsboot = [self.IFaddconst, self.IFadder, self.InstMem,
							 self.IF_ID_Wall, self.register, self.signext, self.control, self.jmpCalc,
							 self.ID_EX_Wall, self.RegDstMux, self.shiftL, self.EXadder, self.ALUSrcMux, self.ALUctrl, self.ALogicUnit,
							 self.EX_MEM_Wall, self.brnch, self.storage,
							 self.MEM_WB_Wall, self.WBmux, self.PCMux, self.JMux]
		self.walls = [self.MEM_WB_Wall, self.EX_MEM_Wall, self.ID_EX_Wall, self.IF_ID_Wall]


		self._connectCPUElements()
示例#2
0
  def __init__(self, memoryFile):
    self.nCycles = 0 # Used to hold number of clock cycles spent executing instructions
    
    self.adder              = Add()
    self.branchAdder        = Add()
    self.alu                = Alu()
    self.aluControl         = AluControl()
    self.branchNE           = BranchNotEqual()
    self.branch             = Branch()
    self.constant           = Constant(4)
    self.control            = Control()
    self.dataMemory         = DataMemory(memoryFile)
    self.instructionMemory  = InstructionMemory(memoryFile)
    self.regMux             = Mux()
    self.aluMux             = Mux()
    self.dmMux              = Mux()
    self.branchMux          = Mux()
    self.jmpMux             = Mux()
    self.registerFile       = RegisterFile()
    self.shiftLeft2         = ShiftLeft2()
    self.signExtend         = SignExtend()
    self.jump               = Jump()
    self.leftShift2         = ShiftLeft2()
    self.leftShift2Jump     = ShiftLeft2Jump()

    self.IFID = IFID()
    self.IDEX = IDEX()
    self.EXMEM = EXMEM()
    self.MEMWB = MEMWB()

    self.pc = PC(0xbfc00200) # hard coded "boot" address
    
    self.IFIDelements = [ self.constant, self.branchMux, self.jmpMux, self.instructionMemory, self.adder ]

    self.IDEXelements = [ self.control, self.registerFile, self.signExtend, self.leftShift2Jump, self.jump ]

    self.EXMEMelements = [ self.regMux, self.aluControl, self.aluMux, self.alu, self.shiftLeft2, self.branchAdder, self.branchNE, self.branch ]
    
    self.MEMWBelements = [ self.dataMemory ]

    self.WBelements = [ self.dmMux ] 

    self.elements = [ self.IFIDelements, self.IDEXelements, self.EXMEMelements, self.WBelements]

    self.pipes = [ self.IFID, self.IDEX, self.EXMEM, self.MEMWB]
    
    self._connectCPUElements()
示例#3
0
    def __init__(self, memoryFile):
        self.nCycles = 0  # Used to hold number of clock cycles spent executing instructions

        self.dataMemory = DataMemory(memoryFile)
        self.instructionMemory = InstructionMemory(memoryFile)
        self.registerFile = RegisterFile()

        self.constant3 = Constant(3)
        self.constant4 = Constant(4)
        self.randomControl = RandomControl()
        self.mux = Mux()
        self.adder = Add()
        self.pc = PC(0xbfc00000)  # hard coded "boot" address

        self.elements = [
            self.constant3, self.constant4, self.randomControl, self.adder,
            self.mux
        ]

        self._connectCPUElements()
示例#4
0
    def __init__(self, memoryFile):

        self.nCycles = 0  # Used to hold number of clock cycles spent executing instructions

        self.datamemory = DataMemory(memoryFile)
        self.instructionmemory = InstructionMemory(memoryFile)
        self.registerfile = RegisterFile()

        self.constant4 = Constant(4)

        self.alu = Alu()
        self.controlunit = ControlUnit()
        self.shift2 = Shift2()
        self.shift16 = Shift16()
        self.signextend = SignExtend()
        self.alterand = Alterand()
        self.altershift = Altershift()

        self.mux_writereg = Mux()  # 6 multiplexors
        self.mux_regoutput = Mux()
        self.mux_jump = Mux()
        self.mux_branch = Mux()
        self.mux_datamem = Mux()
        self.mux_shift16 = Mux()

        self.adderpc = Add()  # 2 adders
        self.addershift = Add()
        self.pc = PC(0xbfc00000)  # hard coded "boot" address

        self.elements = [
            self.constant4, self.adderpc, self.instructionmemory,
            self.controlunit, self.altershift, self.mux_writereg,
            self.registerfile, self.shift16, self.signextend, self.shift2,
            self.addershift, self.mux_regoutput, self.alu, self.alterand,
            self.mux_branch, self.mux_jump, self.datamemory, self.mux_datamem,
            self.mux_shift16, self.registerfile
        ]

        self._connectCPUElements()
示例#5
0
  def __init__(self, memoryFile):
    self.nCycles = 0 # Used to hold number of clock cycles spent executing instructions
    
    self.dataMemory = DataMemory(memoryFile)
    self.instructionMemory = InstructionMemory(memoryFile)
    self.registerFile = RegisterFile()
    self.alu = ALU()
    self.mainControl = MainControl()
    self.splitter = Splitter()
    self.signExtender = SignExtender()
    self.andGate = AndGate()
    self.breaker = Breaker()

    self.constant4 = Constant(4)
    # self.randomControl = RandomControl()
    self.pcMux1 = Mux()
    self.pcMux2 = Mux()
    self.regMux = Mux()
    self.aluMux = Mux()
    self.resultMux = Mux()
    self.luiMux = Mux()

    self.adder = Add()
    self.branchAdder = Add()

    self.jumpAddress = JMPAddress()
    self.shiftBranch = LeftShiftTwo()
    self.shiftJump = LeftShiftTwo()

    self.pc = PC(hex(0xbfc00000))  # hard coded "boot" address
    
    self.elements = [self.constant4, self.adder, self.instructionMemory, self.breaker, self.splitter,
                     self.shiftJump, self.mainControl, self.regMux, self.signExtender, self.luiMux, self.registerFile,
                     self.jumpAddress, self.shiftBranch, self.branchAdder, self.aluMux, self.alu, self.dataMemory,
                     self.andGate, self.pcMux1, self.pcMux2, self.resultMux, self.registerFile, self.pc]
    
    self._connectCPUElements()
示例#6
0
    print '\n--> Error: not correct input!\n--> Usage: python polony_sequencing.py config.txt\n'
    sys.exit()

config = ConfigParser.ConfigParser(
)  # Create configuration file parser object.
config.read(sys.argv[1])  # Fill it in with configuration parameters from file.
logger = Logger(config)  # Initialize logger object.

#---------------------------- Device(s) initialization ---------------------------------

t0 = time.time()  # Get current time.
print '\n'
logger.info('***\t*\t--> Device testing started - test.py')  # Test start.

serial_port = Serial_port(config, logger)  # Initialize serial port object.
mux = Mux(logger)  # Initialize mux object.

syringe_pump = Syringe_pump(config, serial_port,
                            logger)  # Initialize syringe pump object.
rotary_valve = Rotary_valve(config, serial_port,
                            logger)  # Initialize rotary valve object.
temperature_control = Temperature_control(
    config, serial_port, logger)  # Initialize temperature controller object.

#---------------------------------------------------------------------------------------
#								TEMPERATURE CONTROL
#---------------------------------------------------------------------------------------

mux.set_to_temperature_control1(
)  # Switch communication to temperature controller 1.
mux.set_to_temperature_control2(