1
7-1
Section 7 Section 7 Program Sequencer a 7-1 1 ADSP-BF533 Block - - PowerPoint PPT Presentation
Section 7 Section 7 Program Sequencer a 7-1 1 ADSP-BF533 Block Diagram L1 Core Instruction Timer 64 Memory Performance Core LD0 32 Monitor Processor L1 Data LD1 32 Memory JTAG/ Debug SD32 Core D0 bus Core I bus DMA Mastered
1
7-1
2
7-2
Watchdog And Timers DMA Controller UART0 IRDA Real Time Clock Programmable flags SPORTs SPI EBIU 1KB internal Boot ROM
CORE/SYSTEM BUS INTERFACE
32 Core D1 bus 64 Core I bus Core Timer JTAG/ Debug Performance Monitor Core Processor L1 Instruction Memory L1 Data Memory LD1 32 64 PPI
Peripheral Access Bus (PAB) DMA Access Bus (DAB) External Access Bus (EAB)
Power Management Event Controller 32 DMA Mastered bus
Core DA0 bus 32 32 Core D0 bus Core DA1 bus 32
Core Clock (CCLK) Domain System Clock (SCLK) Domain
LD0 32 16 16 16 16
External Port Bus (EPB) DMA Ext Bus (DEB)
16
DMA Core Bus (DCB)
16 SD32
Data Address Control
3
7-3
− Maintains Loops, Subroutines, Jumps, Idle, Interrupts and Exceptions − Contains an 10-stage instruction pipeline − Includes Zero-Overhead Loop Registers
4
7-4
5
7-5
6
7-6
Instruction Function Program Flow Instruction Set up Hardware Loop LSETUP Return from Flow interrupter RTS,RTI,RTX,RTN,RTE Subroutine call CALL Conditional Branch IF CC JUMP IF !CC JUMP Unconditional Branch JUMP
/* indirect jump instruction */
/* indirect jump with offset (PC-relative) */
/* RETS register is loaded with address
/* RETS register is loaded with address
/* jump on condition cc=1 */
7
7-7
− Conditional branch
− Conditional move
− Dreg value can be copied to CC, and vice-versa − Status flag can be copied into CC, and vice-versa
− CC can be set to result of a Preg comparison − CC can be set to result of a Dreg comparison
− BITTST instruction
8
7-8
9
7-9
10
7-10
T I M E
Inst Fetch1 Inst Fetch2 Inst. Decode Address Calc Ex1 Ex2 Ex3 Ex4 Inst Fetch3 WB Inst Fetch1 Inst Fetch2 Inst. Decode Address Calc Ex1 Ex2 Ex3 Ex4 Inst Fetch3 WB
IF1 IF2 IF3 DC AC EX1 EX2 EX4 WB 1 2 3 4 5 6 7 8 9 10 Insta Inst3 Inst2 Inst1 Insta Insta Insta Inst4 Insta Inst5 Insta Inst6 Insta Inst7 Insta Inst8 Insta Inst9 Insta
Pipeline Stage
Inst3 Inst4 Inst5 Inst6 Inst7 Inst8 Inst9 EX3 Inst4 Inst5 Inst6 Inst7 Inst8 Inst9 Inst5 Inst6 Inst7 Inst8 Inst9 Inst6 Inst7 Inst8 Inst9 Inst7 Inst8 Inst9 Inst8 Inst9 Inst9 Inst3 Inst4 Inst5 Inst6 Inst7 Inst8 Inst9 Inst2
11
7-11
− A latency stall condition can occur when two instructions require extra cycles to complete, because they are close to each other in the assembly
diagnosed with the Pipeline Viewer, and can be remedied with some rescheduling.
− Instructions after a branch are invalidated in the pipeline, because they will have entered the pipeline before the actual branch instruction gets serviced
− These instructions take more than one cycle to complete. These extra cycles cannot be avoided without removing the instruction that caused them.
instructions.
12
7-12
− Until SSYNC completes, no further instructions can enter the pipeline.
− CSYNC is typically used after Core MMR writes to prevent imprecise behavior.
13
7-13
− P0=[P1++]; − R0=[P0];
instruction causes a 4-cycle stall.
− P0=R0; − P1=P0+P2;
used as an operand of the second multiplication causes 1-cycle stall
− R0 = A1+=R1.L*R2.L; − R1 = A1+=R0.L*R2.L;
matches), sub-bank (A13 and A12 match), and 32-bit polarity (A2 matches) takes 2 cycles
(e.g. I0 is address 0xFF80 1344, I1 is address 0xFF80 1994) R1 = R4.L * R5.H (IS) || R2 = [I0++] || [I1++] = R3;
14
7-14
15
7-15
− There will be a minimum of four cycles before the new instructions appear in the decoder (except when utilizing the hardware loop buffers)
16
7-16
2 3 1 4 5 6 7 8 9 10 11 12 13 IF1 IF2 IF3 DC AC EX1 EX2 EX3 EX4 WB I1 I1 I1 I1 I1 I1 I1 I1 I1 I1 Br Br Br Br Br Br Br Br Br Br I2 I2 I2 I3 I3 I3 I4 I4 I4 BT BT BT NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP BT BT BT BT I5 I5 I5
I1: Instruction Before the Branch I4: 3rd Instruction After the Branch Br: Branch Instruction I2: 1st Instruction After the Branch I5: 4th Instruction After the Branch BT: Instruction at the Branch Target I3: 2nd Instruction After the Branch
17
7-17
− Example: IF CC JUMP user_label (bp) ;
− If mis-predicted, the branch is corrected and the correction address is put out in the WB stage of the branch instructions
Prediction Taken Not taken Outcome Taken Not taken Taken Not taken Total Cycles to Execute 5 cycles 9 cycles 9 cycles 1 cycle
18
7-18
− RTI, RTX, RTN, RTE − CLI, STI − RAISE − IDLE
− RETI, RETX, RETN, RETE − SEQSTAT, SYSCFG − All Memory Mapped Registers
19
7-19
20
7-20
*Must be set to 1*
21
7-21
zero-overhead nested loops
LT[1:0], LB[1:0], LC[1:0] can be set manually
22
7-22
instruction “loop buffer” which acts like a cache
lsetup(strt, end) lc0 = p4 >> 1; strt: a1 = r0.h * r1.l, a0 = r0.l * r1.l (is) || r0.l = w[i0++] || r2 = [i3++]; a1 += r0.l * r1.h, a0 += r0.h * r1.h (is) || r0.h = w[i0--]; a1 += r0.h * r2.l, a0 += r0.l * r2.l (is) || r0 = [i1++] || r3 = [i3++]; a1 += r0.h * r2.h, a0 += r0.l * r2.h (is) || r0.l = w[i1++]; a1 += r0.l * r3.l, a0 += r0.h * r3.l (is) || r0.h = w[i1--] || r1 = [i3++]; a1 += r0.h * r3.h, a0 += r0.l * r3.h (is) || r0 = [i2++]; a1 += r0.h * r1.l, a0 += r0.l * r1.l (is) || r0.l = w[i2++] || r2 = [i3++]; a1 += r0.l * r1.h, a0 += r0.h * r1.h (is) || r0.h = w[i2--] || r1 = [i3++]; r6.h = (a1 += r0.h * r2.l), r6.l = (a0 += r0.l * r2.l) (is); end: mnop || [p1++] = r6 || r0 = [i0++];
and are immediately available on subsequent iterations
memory, because of the access latencies involved in that case
23
7-23
− A 3 cycle stall is incurred if the LSETUP is not immediately followed by the loop top − If the first instruction of the loop is 64-bits, it must be 64-bit aligned
24
7-24
25
7-25
− Emulation (via SW or external pin) − Reset (via SW or external pin) − Non-Maskable Interrupt (NMI) - for events that require immediate processor attention (via SW or external pin) − Exception − Interrupts
26
7-26
INTERRUPTS
− Asynchronous to program flow − Requested by a peripheral
− Synchronous to program flow − Generated by RAISE instruction
interrupt in the pipeline are killed EXCEPTIONS
− Return address is the address following the excepting instruction − Never re-executed − EXCPT instruction is in this category
− Return address is the address of the excepting instruction − Excepting instruction will be re-executed
The ADSP-BF533 is always in Supervisor Mode while executing Event Handler software and can be in User Mode only while executing application tasks.
27
7-27
28
7-28
Highest Lowest
29
7-29
IVG15 15 General Purpose 15 IVG14 14 General Purpose 14 IVG13 13
General Purpose 13
IVG12 12
General Purpose 12
IVG11 11
General Purpose 11
IVG10 10
General Purpose 10
IVG9 9
General Purpose 9
IVG8 8
General Purpose 8
IVG7 7
General Purpose 7
IVTMR 6 Core Timer IVHW 5 Hardware Error
Reserved EVSW 3 Exceptions NMI 2 Non Maskable Interrupt RST 1 Reset EMU Emulator
IVG13 DMA 10/11 interrupt (MemDMA1) IVG13 DMA 8/9 interrupt (MemDMA0) IVG11 Timer1 interrupt IVG11 Timer2 interrupt IVG12 PF interrupt A IVG12 PF interrupt B IVG13 Watchdog Timer Interrupt IVG11 Timer0 interrupt IVG10 DMA 7 interrupt (UART TX) IVG10 DMA 6 interrupt (UART RX) IVG10 DMA 5 interrupt (SPI) IVG9 DMA 4 interrupt (SPORT1 TX) IVG9 DMA 3 interrupt (SPORT1 RX) IVG9 DMA 2 interrupt (SPORT0 TX) IVG9 DMA 1 interrupt (SPORT0 RX) IVG8 DMA 0 interrupt (PPI) IVG8 RTC interrupt IVG7 UART error interrupt IVG7 SPI error interrupt IVG7 SPORT1 error interrupt IVG7 SPORT0 error interrupt IVG7 PPI error interrupt IVG7 DMA error (generic) IVG7 PLL Wakeup interrupt
Event Source IVG #
Core Event Name
System Interrupt Source IVG #1
1 Note: Default IVG configuration shown.
30
7-30
31
7-31
cleared before exiting the service routine, or the interrupt will be requested again!
(Read-only)
32
7-32
33
7-33
34
7-34
35
7-35
36
7-36
37
7-37
− copies current IMASK to a Dreg − clears IMASK
CLI R0; //Save IMASK into R0 & clear all interrupt bits in IMASK BITSET(R0,8); //Set bit 8 of R0 STI R0; //Restore IMASK with change
38
7-38
− Forces a bit to be set in ILAT. It ‘raises’ the priority of the execution
− Forces an exception to occur : EVSW bit is set in ILAT and ‘n’ determines which exception routine to execute
39
7-39
(Read-only except Bit 4)
40
7-40
− HW Table with 16 32-bit entries accessed as CORE MMRs − EVT0-EVT15 are undefined at Reset − Entries should be programmed in the Reset service routine with the corresponding Interrupt Service Routine vector
41
7-41
− RETI, RETX, RETN, RETE based on event − All interrupts are disabled until the return address (RETI) is pushed
42
7-42
ISR: [--SP] = RETI; // Interrupts enabled [--SP] = ASTAT; [--SP] = FP; [--SP] = (Rx,Ax,Px,Ix); … (Rx,Ax,Px,Ix) = [SP++]; FP = [SP++]; ASTAT = [SP++]; RETI = [SP++]; // Interrupts disabled CSYNC; // Wait until RETI load takes effect, may want to use // SSYNC to confirm system writes have committed. RTI; // Interrupts enabled
43
7-43
44
7-44
45
7-45
interrupt the write-buffer increase in size from 2 deep to 8 deep to off- load the store buffer.
core will stall until the write-buffer size decreases back to 2 deep.
46
7-46
Victim Buffers: Victimized Write-Back Cached Data to external memory Write Buffer: Write-Through and Non-cached Data to external memory
47
7-47
48
7-48
49
7-49
− r0 *= r1; // 3 cycles to execute
− [--SP] = (R7:0, P5:0); // 14 cycles to execute
50
7-50
EMU NMI RST IMASK EVSW Awake from IDLE! IVHW IVTMR
I V G 7 I V G 8 I V G 9 I V G 1 I V G 1 1 I V G 1 2 I V G 1 3 I V G 1 4 I V G 1 5
SIC_IMASK SIC_IWR SIC_ISR
I V G 6 I V G 5 I V G 3 I V G 2 I V G 1 I V G
“Event A“
x F F A 1
FFA0 1000 FFA0 1002 FFA0 1004 FFA0 1008 FFA0 100C FFA0 1010 FFA0 1012 FFA0 1014 FFA0 1016 [- -sp] = P4; [- -sp] = R4; R4.l = 0x1000; P4.H = hi(FLAG_C); P4.L = lo(FLAG_C); W[P4] = R4; R4 = [sp++]; P4 = [sp++]; RTI;
IPEND
C O R E P I P E L I N E
1 1
Keep ILAT Cleared Clear IPEND
ILAT 1
Clear SIC_ISR R0 CLI R0; // 0000 STI R0; // IMASK = R0;
Watchdog MEMDMA1 MEMDMA0 PF B PF A Timer 2 Timer 1 Timer 0 DMA7 (UART TX) DMA6 (UART RX) DMA5 (SPI) DMA4 (Sport1 TX) DMA3 (Sport1 RX) DMA2 (Sport0 TX) DMA1 (Sport0 RX) DMA0 (PPI) RTC ….. DMA Error PLL Wakeup
51
7-51
Respective interrupt enabled Respective interrupt pending or active Respective interrupt latched General Purpose Interrupts #7-#15 IVG7-15 7-15 Interrupt enabled Interrupt pending or active Interrupt latched Core Timer Interrupt IVTMR 6 Interrupt enabled Interrupt pending or active Interrupt latched Hardware Error Interrupt IVHW 5 <reserved> Interrupts globally disabled <reserved> Global Interrupt Disable 4 <reserved> Event pending or active Event latched Exception Event EVX 3 <reserved> Interrupt pending or active Interrupt latched Non-maskable Interrupt NMI 2 <reserved> Event pending or active Event latched Reset Event RST 1 <reserved> Event active Event latched Emulation Event EMU
IMASK=1 means IPEND=1 means ILAT=1 means Description Event Name Bit
52
7-52
53
7-53
− A background task may be waiting for a semaphore that may be provided by an ISR before it can start. The semaphore could indicated the presence of a new buffer of data. − CoreA and CoreB could be sharing a buffer in memory, but only
exclusive access by one core or the other.
54
7-54
testset(p1);
− Typically, a zero is used to indicated a free resource. If CC tests true, the resource is now claimed exclusively for the process. When done with the resource, the process must clear the semaphore. − If CC tests false, it indicates that the resource is being used. Typically, the process waits until the resource becomes free by spinning in a tight loop.