Forum Discussion
Altera_Forum
Honored Contributor
18 years agoWhat if I just said readB<=in1(5 DOWNTO 0) ?
You're right about it being in clock synchronous process. The clock synchronous stuff is supposed to represent the control logic to determine when I'm allowed to do which things in hardware. So I have code like this:
case state is
when A=>--fetch
writeA<='0';
writeB<='0';
writeC<='0';'
writeReg<='0';
opcode<=in1(15 DOWNTO 12);
state <= B;
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);
--etc
state<=C;
when C=>--execute
if(opcode = "0001") then --add
writeReg<='1';
--PC<=next PC
state<=A;
--etc
when D=>--memory
if(opcode = "1000") then --lw
writeReg='0';
state<=E;
--etc
when E=>--writeback
if(opcode = "1000") then
writeReg<='1';
--PC<=next PC
state<=A;
end case;
Basically my control has to go through the different stages. In case B I've set up all the registers but since all of my portmaps happen at the same time everytime, I'm not sure that saying readB<=etc is what I want to do to get an immediate value into my ALU