Altera_Forum
Honored Contributor
17 years agoDecoding/Executing instructions
So I've learned that I can't use port map statements inside a process block and I'm trying my best to NOT think of quartus/VHDL has a sequential programming language, but I'm kind of stuck on something.
I have two back to back statements:
decode: regFile PORT MAP(clock,'0',writeReg,RS,RT,RD,writeD,readA,readB);
execute: alufile PORT MAP(readA,readB,opcode(2 DOWNTO 0),shiftAmt,less,equal,cout,writeD);
The decode takes given register# 's and accesses the data in those registers. The second loads the data from those registers into the ALU. The problem is that depending upon the instruction I may not always want the data from two registers to go into the ALU I may want one input to be an immediate. So I have something like this:
when B=>--decode
--set up all my registers
if(opcode = "0001") then --add
RS<=in1(11 DOWNTO 9);
RT<=in1(8 DOWNTO 6);
RD<=in1(5 DOWNTO 3);
elsif(opcode = "0010") then --ldi
RT<=in1(8 DOWNTO 6);
immed<=in1(5 DOWNTO 0);
readB<=immed;
my idea being that I since I dont have a register, I just want to change the value of the data (readB) that is going into the ALU. I'm just don't think this will work b/c of the timing/order of when things happen. I'm a little confused on that.