The Program Memory is a single port RAM.
That port provides read-only access. Support for the instruction SPM (Store Program Memory) is currently not provided.
The PM is organized on 16 bit words, and has the length set by a constant in the constants definition file (`pavr-constants.vhd').
Apart from controlling the Program Memory, the PM manager also controls the Program Counter.
Some PM access requests need to modify the PC, others don't. The only PM requests that don't modify the PC are the loads from PM (LPM and ELPM instructions). The other requests correspond to instructions that want to modify the instruction flow, thus modify the PC (jumps, branches, calls and returns).
Program Counter handling
At a given time, the pipeline can process more than one instruction. Up to 6 instructions can be simultaneousely processed. Obviousely, each of these instructions has its own address in the PM.
One may ask: how is defined the Program Counter, as long as two or more instructions are simultaneousely executed? Whose address is considered to be the Program Counter?
The answer is: the Program Counter is in fact composed of a set of registers. Each instruction in the pipeline has an associated Program Counter that follows it while flowing through the pipeline. Implementation details can be found in the description of jumps, branches, skips, calls and returns.
As an example, when a relative jump computes the target address, it considers its own Program Counter rather than the address of the instruction fetched that moment from the PM. The instructions that modify the instruction flow (jumps, branches, skips, calls and returns) must be able to manipulate the program counters associated with pipeline stages s1, s2 and s3. However, this is done not directly, but via the Program Memory manager. The PM manager centralizes all instruction flow access requests (jump requests, branch requests, etc) and takes care of the program counters in an organized and manageable manner.
Requests to PM
pavr_s5_lpm_pm_rq
Needed by LPM instruction.
This request doesn't modify the instruction flow.
pavr_s5_elpm_pm_rq
Needed by ELPM instruction.
This request doesn't modify the instruction flow.
pavr_s4_z_pm_rq
Needed by ICALL and IJMP.
pavr_s4_zeind_pm_rq
Needed by EICALL and EIJMP.
pavr_s4_k22abs_pm_rq
Needed by CALL and JMP.
To get to the jump address, the 16 bit instruction constant is concatenated with a 6 bit constant previousely read also from the instruction opcode.
pavr_s4_k12rel_pm_rq
Needed by RCALL and RJMP.
Note that pavr_s4_pc is a pipeline register that holds the Program Memory address of the instruction executing in pipeline stage s4.
Because the relative jump actually occurs in stage s4, pavr_s4_pc is needed rather than the current Program Counter (pavr_pc).
pavr_s6_branch_pm_rq
Needed by branch instructions (BRBC and BRBS).
pavr_s6_skip_pm_rq
Needed by some skip instructions (CPSE, SBRC and SBRS).
pavr_s61_skip_pm_rq
Needed by some skip instructions (SBIC and SBIS).
pavr_s4_k22int_pm_rq
Needed by implicit interrupt CALL.
pavr_s54_ret_pm_rq
Needed by RET and RETI.
Generated on Tue Dec 31 20:26:31 2002 for Pipelined AVR microcontroller by
1.2.16
@
1.1.1.1
log
@Importing into repository the new directory structure.
@
text
@@