You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
general form iexpr in { iexpr_1, iexpr_2, ..., iexpr_4 }
Memory and Clocking
combinational circuits do NOT store any information
sequential circuits - systems that have state and perform on that state
Two classes of memory devices:
clocked registers
clock signal controls the loading of the register with the value at its input
Random Access Memories - store multiple words
virtual memory
the register file
Hardware registers serve as barriers between combinational logic in different parts of the circuit
values only propagate from a register input to its output once every clock cycle at the rising clock edge
Sequential Y86-64 Implementations
Steps/stages of processing an instruction:
Fetch
read bytes of instruction from memory, using PC as the memory address
extract two 4-bit of the instruction specifier code:
icode - instruction code
ifun - instruction function
possibly fetches register specifier byte
possibly fetches an 8-byte constant valC
computes valP - address of instruction following current one in sequential order
valP === PC + length of the fetched instruction
Decode
reads up to two operands from register file
some instructions read register %rsp
Execute
ALU performs operation specified by ifun
condition code possibly set
Memory
may write data to memory
may read data from memory
Write back
write up to two results to register file
PC update
PC set to address of next instruction
processor loops indefinitely
x86-64 convention:
push: decrement the stack pointer before writing
even though the actual updating of stack pointer does not occur until after memory operation has completed
pop: first read memory, then increment stack pointer
call & ret
similar to pushq & popq
but push & pop program counter values
call pushes valP, the address of instruction following call, to stack
ret pushes valM, the value popped from stack, to PC
all processing by hardware units occurs within single clock cycle
PC is the onlyclocked register in SEQ
SEQ Timing
clocked registers:
PC
condition code register
random access memory
register file
instruction memory
data memory
program counter (PC) is loaded with a new instruction address every clock cycle
condition code register is loaded only when an integer operation instruction is executed
data memory written only whenrmmovq, pushq, or call is executed
register ID 0xF as port address -> no write should be performed at this port
the clocking of registers & memories is all that's required to control the sequencing of activities
PRINCIPLE: No reading back
processor never needs to read back the state updated by an instruction in order to complete the processing of this instruction
condition codes are not set until the clock rises to begin the next clock cycle
Cycles of execution in SEQ
each cycle begins with the state elements set according to the previous instruction
program counter
condition
condition code register
register file
data memory
signals propagate through the combinational logic, creating new values for the state elements (mentioned above)
these values are loaded to state elements to start the next cycle
SEQ Stage Implementations
Fetch Stage
includes the instruction memory hardware unit
reads 10 bytes from memory at a time
using PC as address of the first byte (byte 0)
First byte (PC byte) split into two 4-bit values
icode
ifun
imem_error - nop
based on icode, compute 3 1-bit signals:
instr_valid: detect illegal instruction
need_regids: does this instruction include a register specifier type?
need_valC:does this instruction include a constant word
instr_valid & imem_error - generate status code in memory stage
Byte 1 split into:
register specifiers rA & rB, if need_regids is 1
rA & rB both set to 0xF (RNONE) if need_regids is 0
PC incrementer hardware unit
generates signal valP, based on:
current value of PC
the two signals need_regids & need_valC
for PC value p, need_regids value r, need_valC value i,
value generated by incrementer: p + 1 + r + 8i
Decode & Write-Back Stages
Memory Stage
Task of reading/writing data
PC Update Stage
word new_pc=[
# call. use instruction constanticode==ICALL:valC;
# taken branch. use instruction constanticode==IJXX&&Cnd:valC;
# completion of RET instruction. use value from stackicode==IRET:valM;
# default: use incremented PC1:valP;
]