예제 #1
0
if standalone:
    processor.setMemory('dataMem', 10*1024*1024)
else:
    processor.addTLMPort('instrMem', True)
    processor.addTLMPort('dataMem')
    processor.setTLMMem(10*1024*1024, 0, True)
#processor.setMemory('dataMem', 10*1024*1024, True, 'PC')

# It PSR[ET] == 0 I do not do anything; else
# I check the interrupt level, if == 15 or > PSR[PIL] I service the interrupt,
# The interrupt level is carried by the value at the interrupt port
# Otherwise it is treated like a normal exception, to I jump to the
# TBR: we can use a routine for this ...
# At the end I have to acknowledge the interrupt, by writing on the ack
# port.
irqPort = trap.Interrupt('IRQ', 32)
irqPort.setOperation("""
pcounter = PC;
#ifndef ACC_MODEL
npcounter = NPC;
#endif
""", 'fetch')
irqPort.setOperation("""
#ifdef ACC_MODEL
npcounter = PC;
#endif
""", 'decode')
irqPort.setOperation("""//Basically, what I have to do when
//an interrupt arrives is very simple: we check that interrupts
//are enabled and that the the processor can take this interrupt
//(valid interrupt level). The we simply raise an exception and
예제 #2
0
processor.addMemAlias(idMap)
# register from which the instructions are fetched; note that in the
# functional model there is an offset between the PC and the actual
# fetch address (all of this is to take into account the fact that we do
# not have the pipeline)
processor.setFetchRegister('PC', -4)

# Lets now add details about the processor interconnection (i.e. memory ports,
# interrupt ports, pins, etc.)
if processor.systemc:
    processor.addTLMPort('instrMem', True)
    processor.addTLMPort('dataMem')
else:
    processor.addMemory('dataMem', 10 * 1024 * 1024)
# Now lets add the interrupt ports
irq = trap.Interrupt('IRQ', 1, priority=0)
irq.setOperation(
    'CPSR[CPSR_I] == 0', """
//Save LR_irq
LR_IRQ = PC;
//Save the current PSR
SPSR[1] = CPSR;
//I switch the register bank (i.e. I update the
//alias)
REGS[13].update_alias(RB[21]);
REGS[14].update_alias(RB[22]);
//Create the new PSR
CPSR = (CPSR & 0xFFFFFFD0) | 0x00000092;
//Finally I update the PC
PC = 0x18;""")
#processor.addIrq(irq)