Line 35... |
Line 35... |
stackPointerBitNb : positive := 5;
|
stackPointerBitNb : positive := 5;
|
instructionBitNb : positive := 18;
|
instructionBitNb : positive := 18;
|
scratchpadAddressBitNb : natural := 4
|
scratchpadAddressBitNb : natural := 4
|
);
|
);
|
PORT(
|
PORT(
|
reset => reset,
|
reset : IN std_uLogic;
|
clock => clock,
|
clock : IN std_uLogic;
|
en => en,
|
en : IN std_uLogic;
|
progCounter => programCounter,
|
progCounter : OUT unsigned(programCounterBitNb-1 DOWNTO 0);
|
instruction => instruction,
|
instruction : IN std_ulogic_vector(instructionBitNb-1 DOWNTO 0);
|
dataAddress => dataAddress,
|
dataAddress : OUT unsigned(addressBitNb-1 DOWNTO 0);
|
dataOut => dataOut,
|
dataOut : OUT std_ulogic_vector(registerBitNb-1 DOWNTO 0);
|
dataIn => dataIn,
|
dataIn : IN std_ulogic_vector(registerBitNb-1 DOWNTO 0);
|
readStrobe => readStrobe,
|
readStrobe : OUT std_uLogic;
|
writeStrobe => writeStrobe,
|
writeStrobe : OUT std_uLogic;
|
int => int,
|
int : IN std_uLogic;
|
intAck => intAck
|
intAck : OUT std_ulogic
|
);
|
);
|
END nanoProcessor ;
|
END nanoProcessor ;
|
|
|
--==============================================================================
|
--==============================================================================
|
|
|
Line 107... |
Line 107... |
aluCodeBitNb : positive := 5;
|
aluCodeBitNb : positive := 5;
|
portAddressBitNb : positive := 8;
|
portAddressBitNb : positive := 8;
|
scratchpadAddressBitNb : natural := 4
|
scratchpadAddressBitNb : natural := 4
|
);
|
);
|
PORT (
|
PORT (
|
|
reset : IN std_ulogic;
|
|
clock : IN std_ulogic;
|
|
aluCode : IN std_ulogic_vector(aluCodeBitNb-1 DOWNTO 0);
|
addrA : IN unsigned(registerAddressBitNb-1 DOWNTO 0);
|
addrA : IN unsigned(registerAddressBitNb-1 DOWNTO 0);
|
addrB : IN unsigned(registerAddressBitNb-1 DOWNTO 0);
|
addrB : IN unsigned(registerAddressBitNb-1 DOWNTO 0);
|
aluCode : IN std_ulogic_vector(aluCodeBitNb-1 DOWNTO 0);
|
|
cIn : IN std_ulogic;
|
|
clock : IN std_ulogic;
|
|
instrData : IN signed(registerBitNb-1 DOWNTO 0);
|
instrData : IN signed(registerBitNb-1 DOWNTO 0);
|
|
registerFileSel : IN std_ulogic;
|
instrDataSel : IN std_ulogic;
|
instrDataSel : IN std_ulogic;
|
portIn : IN signed(registerBitNb-1 DOWNTO 0);
|
|
portInSel : IN std_ulogic;
|
portInSel : IN std_ulogic;
|
regWrite : IN std_ulogic;
|
|
registerFileSel : IN std_ulogic;
|
|
reset : IN std_ulogic;
|
|
scratchpadSel : IN std_ulogic;
|
scratchpadSel : IN std_ulogic;
|
spadIn : IN signed(registerBitNb-1 DOWNTO 0);
|
regWrite : IN std_ulogic;
|
|
cIn : IN std_ulogic;
|
cOut : OUT std_ulogic;
|
cOut : OUT std_ulogic;
|
|
zero : OUT std_ulogic;
|
portAddr : OUT unsigned(portAddressBitNb-1 DOWNTO 0);
|
portAddr : OUT unsigned(portAddressBitNb-1 DOWNTO 0);
|
portOut : OUT signed(registerBitNb-1 DOWNTO 0);
|
portOut : OUT signed(registerBitNb-1 DOWNTO 0);
|
|
portIn : IN signed(registerBitNb-1 DOWNTO 0);
|
scratchpadAddr : OUT unsigned(scratchpadAddressBitNb-1 DOWNTO 0);
|
scratchpadAddr : OUT unsigned(scratchpadAddressBitNb-1 DOWNTO 0);
|
spadOut : OUT signed(registerBitNb-1 DOWNTO 0);
|
spadOut : OUT signed(registerBitNb-1 DOWNTO 0);
|
zero : OUT std_ulogic
|
spadIn : IN signed(registerBitNb-1 DOWNTO 0)
|
);
|
);
|
END COMPONENT;
|
END COMPONENT;
|
|
|
COMPONENT branchStack
|
COMPONENT branchStack
|
GENERIC (
|
GENERIC (
|
programCounterBitNb : positive := 10;
|
programCounterBitNb : positive := 10;
|
stackPointerBitNb : positive := 5
|
stackPointerBitNb : positive := 5
|
);
|
);
|
PORT (
|
PORT (
|
|
reset : IN std_ulogic;
|
clock : IN std_ulogic;
|
clock : IN std_ulogic;
|
prevPC : IN std_ulogic;
|
|
progCounter : IN unsigned(programCounterBitNb-1 DOWNTO 0);
|
progCounter : IN unsigned(programCounterBitNb-1 DOWNTO 0);
|
reset : IN std_ulogic;
|
prevPC : IN std_ulogic;
|
storePC : IN std_ulogic;
|
storePC : IN std_ulogic;
|
storedProgCounter : OUT unsigned(programCounterBitNb-1 DOWNTO 0 )
|
storedProgCounter : OUT unsigned(programCounterBitNb-1 DOWNTO 0 )
|
);
|
);
|
END COMPONENT;
|
END COMPONENT;
|
|
|
Line 152... |
Line 152... |
intCodeBitNb : positive := 5;
|
intCodeBitNb : positive := 5;
|
branchCondBitNb : positive := 3;
|
branchCondBitNb : positive := 3;
|
opCodeBitNb : positive := 5
|
opCodeBitNb : positive := 5
|
);
|
);
|
PORT (
|
PORT (
|
branchCond : IN std_ulogic_vector(branchCondBitNb-1 DOWNTO 0);
|
reset : IN std_ulogic;
|
cOut : IN std_ulogic;
|
|
clock : IN std_ulogic;
|
clock : IN std_ulogic;
|
en : IN std_ulogic;
|
en : IN std_ulogic;
|
int : IN std_ulogic;
|
|
intCode : IN std_ulogic_vector(intCodeBitNb-1 DOWNTO 0);
|
|
opCode : IN std_ulogic_vector(opCodeBitNb-1 DOWNTO 0);
|
opCode : IN std_ulogic_vector(opCodeBitNb-1 DOWNTO 0);
|
reset : IN std_ulogic;
|
|
twoRegInstr : IN std_ulogic;
|
twoRegInstr : IN std_ulogic;
|
|
registerFileSel : OUT std_ulogic;
|
|
instrDataSel : OUT std_ulogic;
|
|
portInSel : OUT std_ulogic;
|
|
scratchpadSel : OUT std_ulogic;
|
|
regWrite : OUT std_ulogic;
|
|
readStrobe : OUT std_ulogic;
|
|
writeStrobe : OUT std_uLogic;
|
|
scratchpadWrite : OUT std_ulogic;
|
|
branchCond : IN std_ulogic_vector(branchCondBitNb-1 DOWNTO 0);
|
|
cOut : IN std_ulogic;
|
zero : IN std_ulogic;
|
zero : IN std_ulogic;
|
cIn : OUT std_ulogic;
|
cIn : OUT std_ulogic;
|
incPC : OUT std_ulogic;
|
incPC : OUT std_ulogic;
|
instrDataSel : OUT std_ulogic;
|
|
intAck : OUT std_ulogic;
|
|
loadInstrAddress : OUT std_ulogic;
|
loadInstrAddress : OUT std_ulogic;
|
loadStoredPC : OUT std_ulogic;
|
loadStoredPC : OUT std_ulogic;
|
portInSel : OUT std_ulogic;
|
|
prevPC : OUT std_ulogic;
|
prevPC : OUT std_ulogic;
|
readStrobe : OUT std_ulogic;
|
|
regWrite : OUT std_ulogic;
|
|
registerFileSel : OUT std_ulogic;
|
|
scratchpadSel : OUT std_ulogic;
|
|
scratchpadWrite : OUT std_ulogic;
|
|
storePC : OUT std_ulogic;
|
storePC : OUT std_ulogic;
|
writeStrobe : OUT std_uLogic
|
intCode : IN std_ulogic_vector(intCodeBitNb-1 DOWNTO 0);
|
|
int : IN std_ulogic;
|
|
intAck : OUT std_ulogic
|
);
|
);
|
END COMPONENT;
|
END COMPONENT;
|
|
|
COMPONENT instructionDecoder
|
COMPONENT instructionDecoder
|
GENERIC (
|
GENERIC (
|
Line 195... |
Line 195... |
spadAddressBitNb : natural := 4;
|
spadAddressBitNb : natural := 4;
|
portAddressBitNb : positive := 8
|
portAddressBitNb : positive := 8
|
);
|
);
|
PORT (
|
PORT (
|
instruction : IN std_ulogic_vector(instructionBitNb-1 DOWNTO 0);
|
instruction : IN std_ulogic_vector(instructionBitNb-1 DOWNTO 0);
|
|
aluCode : OUT std_ulogic_vector(aluCodeBitNb-1 DOWNTO 0);
|
addrA : OUT unsigned(registerAddressBitNb-1 DOWNTO 0);
|
addrA : OUT unsigned(registerAddressBitNb-1 DOWNTO 0);
|
addrB : OUT unsigned(registerAddressBitNb-1 DOWNTO 0);
|
addrB : OUT unsigned(registerAddressBitNb-1 DOWNTO 0);
|
aluCode : OUT std_ulogic_vector(aluCodeBitNb-1 DOWNTO 0);
|
|
branchCond : OUT std_ulogic_vector(branchCondBitNb-1 DOWNTO 0);
|
|
instrAddress : OUT unsigned(programCounterBitNb-1 DOWNTO 0);
|
|
instrData : OUT signed(registerBitNb-1 DOWNTO 0);
|
instrData : OUT signed(registerBitNb-1 DOWNTO 0);
|
intCode : OUT std_ulogic_vector(intCodeBitNb-1 DOWNTO 0);
|
instrAddress : OUT unsigned(programCounterBitNb-1 DOWNTO 0);
|
opCode : OUT std_ulogic_vector(opCodeBitNb-1 DOWNTO 0);
|
opCode : OUT std_ulogic_vector(opCodeBitNb-1 DOWNTO 0);
|
portAddress : OUT unsigned(portAddressBitNb-1 DOWNTO 0);
|
twoRegInstr : OUT std_ulogic;
|
|
branchCond : OUT std_ulogic_vector(branchCondBitNb-1 DOWNTO 0);
|
|
intCode : OUT std_ulogic_vector(intCodeBitNb-1 DOWNTO 0);
|
portIndexedSel : OUT std_ulogic;
|
portIndexedSel : OUT std_ulogic;
|
spadAddress : OUT unsigned(spadAddressBitNb-1 DOWNTO 0);
|
portAddress : OUT unsigned(portAddressBitNb-1 DOWNTO 0);
|
spadIndexedSel : OUT std_ulogic;
|
spadIndexedSel : OUT std_ulogic;
|
twoRegInstr : OUT std_ulogic
|
spadAddress : OUT unsigned(spadAddressBitNb-1 DOWNTO 0)
|
);
|
);
|
END COMPONENT;
|
END COMPONENT;
|
|
|
COMPONENT programCounter
|
COMPONENT programCounter
|
GENERIC (
|
GENERIC (
|
programCounterBitNb : positive := 10
|
programCounterBitNb : positive := 10
|
);
|
);
|
PORT (
|
PORT (
|
|
reset : IN std_ulogic;
|
clock : IN std_ulogic;
|
clock : IN std_ulogic;
|
incPC : IN std_ulogic;
|
|
instrAddress : IN unsigned(programCounterBitNb-1 DOWNTO 0);
|
instrAddress : IN unsigned(programCounterBitNb-1 DOWNTO 0);
|
|
storedProgCounter : IN unsigned(programCounterBitNb-1 DOWNTO 0);
|
|
incPC : IN std_ulogic;
|
loadInstrAddress : IN std_ulogic;
|
loadInstrAddress : IN std_ulogic;
|
loadStoredPC : IN std_ulogic;
|
loadStoredPC : IN std_ulogic;
|
reset : IN std_ulogic;
|
|
storedProgCounter : IN unsigned(programCounterBitNb-1 DOWNTO 0);
|
|
progCounter : OUT unsigned(programCounterBitNb-1 DOWNTO 0 )
|
progCounter : OUT unsigned(programCounterBitNb-1 DOWNTO 0 )
|
);
|
);
|
END COMPONENT;
|
END COMPONENT;
|
|
|
COMPONENT scratchpad
|
COMPONENT scratchpad
|
GENERIC (
|
GENERIC (
|
registerBitNb : positive := 8;
|
registerBitNb : positive := 8;
|
spadAddressBitNb : natural := 4
|
spadAddressBitNb : natural := 4
|
);
|
);
|
PORT (
|
PORT (
|
addr : IN unsigned(spadAddressBitNb-1 DOWNTO 0);
|
|
clock : IN std_ulogic;
|
|
dataIn : IN signed(registerBitNb-1 DOWNTO 0);
|
|
reset : IN std_ulogic;
|
reset : IN std_ulogic;
|
|
clock : IN std_ulogic;
|
|
addr : IN unsigned(spadAddressBitNb-1 DOWNTO 0);
|
write : IN std_ulogic;
|
write : IN std_ulogic;
|
|
dataIn : IN signed(registerBitNb-1 DOWNTO 0);
|
dataOut : OUT signed(registerBitNb-1 DOWNTO 0 )
|
dataOut : OUT signed(registerBitNb-1 DOWNTO 0 )
|
);
|
);
|
END COMPONENT;
|
END COMPONENT;
|
|
|
BEGIN
|
BEGIN
|
Line 252... |
Line 252... |
aluCodeBitNb => aluCodeBitNb,
|
aluCodeBitNb => aluCodeBitNb,
|
portAddressBitNb => addressBitNb,
|
portAddressBitNb => addressBitNb,
|
scratchpadAddressBitNb => scratchpadAddressBitNb
|
scratchpadAddressBitNb => scratchpadAddressBitNb
|
)
|
)
|
PORT MAP (
|
PORT MAP (
|
|
reset => reset,
|
|
clock => clock,
|
|
aluCode => aluCode,
|
addrA => addrA,
|
addrA => addrA,
|
addrB => addrB,
|
addrB => addrB,
|
aluCode => aluCode,
|
|
cIn => cIn,
|
|
clock => clock,
|
|
instrData => instrData,
|
instrData => instrData,
|
|
registerFileSel => registerFileSel,
|
instrDataSel => instrDataSel,
|
instrDataSel => instrDataSel,
|
portIn => portIn,
|
|
portInSel => portInSel,
|
portInSel => portInSel,
|
regWrite => regWrite,
|
|
registerFileSel => registerFileSel,
|
|
reset => reset,
|
|
scratchpadSel => scratchpadSel,
|
scratchpadSel => scratchpadSel,
|
spadIn => spadIn,
|
regWrite => regWrite,
|
|
cIn => cIn,
|
cOut => cOut,
|
cOut => cOut,
|
|
zero => zero,
|
portAddr => portRegAddress,
|
portAddr => portRegAddress,
|
portOut => portOut,
|
portOut => portOut,
|
|
portIn => portIn,
|
scratchpadAddr => spadRegAddress,
|
scratchpadAddr => spadRegAddress,
|
spadOut => spadOut,
|
spadOut => spadOut,
|
zero => zero
|
spadIn => spadIn
|
);
|
);
|
|
|
I_BR : branchStack
|
I_BR : branchStack
|
GENERIC MAP (
|
GENERIC MAP (
|
programCounterBitNb => programCounterBitNb,
|
programCounterBitNb => programCounterBitNb,
|
stackPointerBitNb => stackPointerBitNb
|
stackPointerBitNb => stackPointerBitNb
|
)
|
)
|
PORT MAP (
|
PORT MAP (
|
|
reset => reset,
|
clock => clock,
|
clock => clock,
|
prevPC => prevPC,
|
|
progCounter => progCounter_int,
|
progCounter => progCounter_int,
|
reset => reset,
|
prevPC => prevPC,
|
storePC => storePC,
|
storePC => storePC,
|
storedProgCounter => storedProgCounter
|
storedProgCounter => storedProgCounter
|
);
|
);
|
|
|
I_ctrl : controller
|
I_ctrl : controller
|
Line 295... |
Line 295... |
intCodeBitNb => 5,
|
intCodeBitNb => 5,
|
branchCondBitNb => branchCondBitNb,
|
branchCondBitNb => branchCondBitNb,
|
opCodeBitNb => opCodeBitNb
|
opCodeBitNb => opCodeBitNb
|
)
|
)
|
PORT MAP (
|
PORT MAP (
|
branchCond => branchCond,
|
reset => reset,
|
cOut => cOut,
|
|
clock => clock,
|
clock => clock,
|
en => en,
|
en => en,
|
int => int,
|
|
intCode => intCode,
|
|
opCode => opCode,
|
opCode => opCode,
|
reset => reset,
|
|
twoRegInstr => twoRegInstr,
|
twoRegInstr => twoRegInstr,
|
|
registerFileSel => registerFileSel,
|
|
instrDataSel => instrDataSel,
|
|
portInSel => portInSel,
|
|
scratchpadSel => scratchpadSel,
|
|
regWrite => regWrite,
|
|
readStrobe => readStrobe,
|
|
writeStrobe => writeStrobe
|
|
scratchpadWrite => scratchpadWrite,
|
|
branchCond => branchCond,
|
|
cOut => cOut,
|
zero => zero,
|
zero => zero,
|
cIn => cIn,
|
cIn => cIn,
|
incPC => incPC,
|
incPC => incPC,
|
instrDataSel => instrDataSel,
|
|
intAck => intAck,
|
|
loadInstrAddress => loadInstrAddress,
|
loadInstrAddress => loadInstrAddress,
|
loadStoredPC => loadStoredPC,
|
loadStoredPC => loadStoredPC,
|
portInSel => portInSel,
|
|
prevPC => prevPC,
|
prevPC => prevPC,
|
readStrobe => readStrobe,
|
|
regWrite => regWrite,
|
|
registerFileSel => registerFileSel,
|
|
scratchpadSel => scratchpadSel,
|
|
scratchpadWrite => scratchpadWrite,
|
|
storePC => storePC,
|
storePC => storePC,
|
writeStrobe => writeStrobe
|
intCode => intCode,
|
|
int => int,
|
|
intAck => intAck
|
);
|
);
|
|
|
I_instr : instructionDecoder
|
I_instr : instructionDecoder
|
GENERIC MAP (
|
GENERIC MAP (
|
registerBitNb => registerBitNb,
|
registerBitNb => registerBitNb,
|
Line 337... |
Line 337... |
spadAddressBitNb => scratchpadAddressBitNb,
|
spadAddressBitNb => scratchpadAddressBitNb,
|
portAddressBitNb => addressBitNb
|
portAddressBitNb => addressBitNb
|
)
|
)
|
PORT MAP (
|
PORT MAP (
|
instruction => instruction,
|
instruction => instruction,
|
|
aluCode => aluCode,
|
addrA => addrA,
|
addrA => addrA,
|
addrB => addrB,
|
addrB => addrB,
|
aluCode => aluCode,
|
|
branchCond => branchCond,
|
|
instrAddress => instrAddress,
|
|
instrData => instrData,
|
instrData => instrData,
|
intCode => intCode,
|
instrAddress => instrAddress,
|
opCode => opCode,
|
opCode => opCode,
|
portAddress => portInstrAddress,
|
twoRegInstr => twoRegInstr,
|
|
branchCond => branchCond,
|
|
intCode => intCode,
|
portIndexedSel => portIndexedSel,
|
portIndexedSel => portIndexedSel,
|
spadAddress => spadInstrAddress,
|
portAddress => portInstrAddress,
|
spadIndexedSel => spadIndexedSel,
|
spadIndexedSel => spadIndexedSel,
|
twoRegInstr => twoRegInstr
|
spadAddress => spadInstrAddress
|
);
|
);
|
|
|
I_PC : programCounter
|
I_PC : programCounter
|
GENERIC MAP (
|
GENERIC MAP (
|
programCounterBitNb => programCounterBitNb
|
programCounterBitNb => programCounterBitNb
|
)
|
)
|
PORT MAP (
|
PORT MAP (
|
|
reset => reset,
|
clock => clock,
|
clock => clock,
|
incPC => incPC,
|
|
instrAddress => instrAddress,
|
instrAddress => instrAddress,
|
|
storedProgCounter => storedProgCounter,
|
|
incPC => incPC,
|
loadInstrAddress => loadInstrAddress,
|
loadInstrAddress => loadInstrAddress,
|
loadStoredPC => loadStoredPC,
|
loadStoredPC => loadStoredPC,
|
reset => reset,
|
|
storedProgCounter => storedProgCounter,
|
|
progCounter => progCounter_int
|
progCounter => progCounter_int
|
);
|
);
|
|
|
generate_scratchpad: IF scratchpadAddressBitNb > 0 GENERATE
|
generate_scratchpad: IF scratchpadAddressBitNb > 0 GENERATE
|
BEGIN
|
BEGIN
|
Line 375... |
Line 375... |
GENERIC MAP (
|
GENERIC MAP (
|
registerBitNb => registerBitNb,
|
registerBitNb => registerBitNb,
|
spadAddressBitNb => scratchpadAddressBitNb
|
spadAddressBitNb => scratchpadAddressBitNb
|
)
|
)
|
PORT MAP (
|
PORT MAP (
|
addr => spadAddress,
|
|
clock => clock,
|
|
dataIn => spadOut,
|
|
reset => reset,
|
reset => reset,
|
|
clock => clock,
|
|
addr => spadAddress,
|
write => scratchpadWrite,
|
write => scratchpadWrite,
|
|
dataIn => spadOut,
|
dataOut => spadIn
|
dataOut => spadIn
|
);
|
);
|
END GENERATE generate_scratchpad;
|
END GENERATE generate_scratchpad;
|
|
|
portIn <= signed(dataIn);
|
portIn <= signed(dataIn);
|