TC1796
System Units (Vol. 1 of 2)
Peripheral Control Processor (PCP)
User’s Manual
11-116
V2.0, 2007-07
PCP, V2.0
11.12.6
Case-like Code Switches (Computed Go-To)
The JC.I instruction can be used to implement a multi-way branch for branch-on-bit or
branch-on-state conditional branches. This instruction allows a conditional relative jump
based on an index held in a register. If this instruction is combined with a table of jump
addresses, a switch-type statement can be implemented. The default case, that is when
the condition code = False, is the next instruction, as is the jump with register index = 0.
The table can be any arbitrary length. The index register should be checked for range
before the jump into the table is performed.
For Example:
COMP R3,#5
;compare R3 to #5 - the number of
;entries in the table
JC.I R3,cc_ULE
DEFAULT:
JL
#case_0
;destination if R3 = 0 or
;condition = false
JL
#case_1
;destination if R3 = 1
JL
#case_2
;destination if R3 = 2
JL
#case_3
;destination if R3 = 3
JL
#case_4
;destination if R3 = 4
JL
#case_5
;destination if R3 = 5
11.12.7
Simple DMA Operation
A simple interrupt-driven DMA requires at least the Small Context Model to operate
properly. Its operation is comprised of three stages:
•
The device interrupts the PCP to indicate it can receive or provide data.
•
The PCP moves the amount of data it is programmed to move.
•
The PCP eventually finishes and interrupts the CPU to notify it that the DMA is
complete.
There are two options for implementing a simple DMA operation, copy and burst copy.
11.12.7.1 COPY Instruction
A simple DMA channel program can consist of just two instructions. In the example
below, a device interrupts the PCP to notify it that it has data in its output buffer, which
is 4 words deep. The COPY instruction copies 4 words to memory at a time. It
decrements CNT1 (which is initialized by the CPU in CR6_CNT1 context) after each 4
word transfer. The EXIT command then executes, and if CNT1 was decremented to 0,
the condition code causes it to issue an interrupt with the value held R6_SRPN.
COPY DST+,SRC,CNC=1,BRST=4,SIZE=32
;do peripheral -> memory DMA
EXIT EC=0,ST=0,INT=1,EP=0,cc_CNZ
;transfer done, so exit