Tricore Architecture 2011
Tricore Architecture 2011
TC1.3.1
Contents
DSP
+ Dual Integer MAC Unit
+ Floating Point MAC Unit
+ DSP Addressing Modes
+ Rounding, Saturation
+ Zero Overhead Loop
TriCore™ Block Diagram
Data Register :
Floating Point Unit
PMI D0-D15 DMI
Program Data
Instruction Address Register :
Memory Control Unit
Integer Execution Unit
A0-A15 Memory
Interface 64 64 Interface
System Register :
Load/Store Unit
PC,PSW,PCXI
(RAM/ (RAM)
Cache)
TriCore Core Special Function
Register
Interrupt
Control Unit 64
SMIF
DMA
8 Channels 1.5V / 3.3V / (5V)
2 MB PFLASH MEMCK
64 KB DFLASH LFI Bridge Ext. Supply
M/S
8 KB OVRAM
16 KB BROM MLI0
ASC0 ADC0 28
Interrupts
16 Channels
PCP2 SCU (5V max)
Core ADC1
ASC1 16 Channels
4
Ports
16 KB PCODE
FADC (3.3V)
4 diff ch. (3.3V max)
4
GPTA0 SSC0
fFPI
Ext. MultiCAN PLL
Request (64 Buffers)
MSC0 SBCU fCPU
LTC0 (0-31) (LVDS)
Unit SSC1
0 1
AUDO-Max: TC1782 Block diagram
FPU DMI SPRAM: Scratch-Pad RAM
PMI ICACHE: Instruction cache
DCACHE: Data Cache
24 kB SPRAM TriCore 124 kB LDRAM
LDRAM: Local Data RAM
16 kB ICACHE 64 (TC1.3.1) 128 4 kB DCACHE BROM: Boot ROM
(SW configurable)
(SW configurable) PFlash: Program Flash
CPS DFlash: Data Flash
OVRAM: Overlay SRAM
Local Memory Bus PRAM: Parameter RAM In PCP
PCODE: Code RAM in PCP
LMB: Local Memory Bus
BCU 64 SPB: System Peripheral Bus
M OCDS
PMU JTAG
SMIF
DMA
16 Channels 1.3V / 3.3V / (5V)
2.5 MB PFLASH MEMCK
128 KB DFLASH LFI Bridge Ext. Supply
M/S
8 KB OVRAM
16 KB BROM MLI0
ASC0 ADC0 28
Interrupts
16 Channels
PCP2 SCU (5V max)
ASC1 Core ADC1
16 Channels
E-Ray 4
(2 Channels)
Ports
32 KB PCODE
FADC (3.3V)
4 diff ch. (3.3V max)
SSC0 4
GPTA0
PLL fE-Ray
Ext. SSC1
MultiCAN E-RAY
Request (128 MO)
MSC0 SBCU
LTC0 (0-31) (LVDS)
Unit SSC2 PLL fCPU
0 1 2
Contents
Instruction 1
Instruction
Instruction 1
1 MAC MAC
Instruction 2 Execute
Write
Execute
Back
32Bit
Integer
Decode
The
The Issue
Issue Unit
Unit forwards
forwards
Instruction 1
Fetch The Fetch
multiple Unit
Integer
multiple Instruction
Instruction
Execute
Fetches
Instruction
into
1
into the
the
64 bit Integer Pipeline
& multiple
four Instructions
four pipelines(
pipelines( 1-3)in
1-3)
Issue parallel (2-4)
Load/ Load/
32Bit Store Store Instruction Write
2 Load/Store Pipeline
Decode InstructionBack
Execute Instruction 21
Instruction 2
Instruction 3
2
Instruction
Instruction 4
3
Loop Instruction 2
3
1 Loop Pipeline
Cache Loop Write
Buffer Execute Back
MAC Execute 1
Integer
MAC Execute 2
Integer Write
Integer Execute
Decode Back
Fetch
Load /
Store
Load / Store Load / Store Write
Decode Execute Back
Loop
Loop Cache Loop Write
Buffer Execute Back
Pipeline : Super-scalar Execution
Integer pipeline:
Integer arithmetic and logic instructions.
Bit operations.
Divide and MAC instructions.
Etc.
Load /Store pipeline:
Load / Store instructions.
Context operations.
Address arithmetic instructions.
Etc.
Loop pipeline:
Loop instructions.
Coproc. Pipeline
A7 D7
E6
A6 D6
A5 D5
E4
A4 D4
A3 D3
E2
A2 D2
A1 (Global Address) D1
E0
A0 (Global Address) D0
System Register
Context Management
LCX Free CSA List Limit Pointer ISP Interrupt Stack Pointer
Contents
32-bit address
31 28 27 0
Segment 28 – bit address within a segment.
Segment Description
MMU not . .
. .
implemented . .
in TC179x
0x0 Reserved (MMU space)
A15 D15
E14
A14 D14
Upper A13 D13
E12
Context A12 D12
A11 (Return Address) D11
E10
A10 (Stack Pointer) D10
PSW A9 (Global Address) D9
E8
PCXI A8 (Global Address) D8
A7 D7
E6
A6 D6
Lower A5 D5
E4
Context A4 D4
A3 D3
E2
A2 D2
Saved PC A1(Global Address) D2
E0
PCXI A0 (Global Address) D0
Address Data
Upper/Lower Context Saving and Restoring
CALL
store to context STLCX
Interrupt
save area BISR
Trap
Regular context
switch
restore from RET
RSLCX
context save area RFE
CSA 2 CSA 1
CSA 3
2 1
Link to 4
10.02.2010 Copyright © Infineon Technologies 2010. All rights reserved. Page 33
After Saving in CSA
CSA 4 CSA 5
Link to 5 “0”
FCX
DMI
Context Area: Initialization in cstart.c
int i, k;
int no_of_csas;
int * csa;
unsigned int seg_nr, seg_idx, pcxi_val=0;
_Bool first=true;
for (i=0; i < MAX_NR_OF_CSA_AREAS; i++)
{
/* first calculate nr of CSAs in this area */
no_of_csas = (csa_area_end[i] - csa_area_begin[i]) >> 4;
for (k=0; k < no_of_csas; k++)
{
csa = csa_area_begin[i] + k*16;
/* Store null pointer in last CSA (= very first time!) */
*csa = pcxi_val;
seg_nr = __extru( (int) csa, 28, 4) << 16;
seg_idx = __extru( (int) csa, 6, 16);
pcxi_val = seg_nr | seg_idx;
if (first)
{
first = false;
__mtcr(LCX, pcxi_val);
}
}
__mtcr(FCX, pcxi_val);
}
10.02.2010 Copyright © Infineon Technologies 2010. All rights reserved. Page 38
Contents
7 6 5 4 3 2 1 0
Peripheral Peripheral Peripheral Peripheral Peripheral Peripheral
Arbitration Bus
FPI Bus
TC1797 @ 180 Mhz
• 150 ns interrupt response time Int. Ack.
Interrupt
until execution of first instruction Control
Unit (ICU)
within Interrupt Service Routine Int. Req.
xx_SRC
15 14 13 12 11 10 9 8 7 0
SET CLR
SRR SRE TOS res SPRN
R R
ICR.IE
SRR SRE TOS 0
xx_SRC.SRPN
Periperals
Service
On-Chip
0 00 =0...255
1
1 01 PICU
Software
SETR=1
Service Request Priority Number(SRPN)
1 or 2 clocks
5 cycles
CPU Task Priority Check ISR
Acknowledge
ICU to CPU
Arbitration
Execute
Decode
Context
to ICU
Fetch
Save
Interrupt Interrupt
Issued Served
Interrupt Vector Table
Interrupt Vector Table
Priority 255 // Interrupt defined w/ PPN = 3
void __interrupt(3) stm_isr()
{
// user code
}
9 // Interrupt defined w/ PPN = 4
8 void __interrupt(4) asc_isr ()
{
7 j gpta_isr // user code
6 }
5 // Interrupt defined w/ PPN = 7
4 j asc_isr void __interrupt(7) gpta_isr()
{
3 j stm_isr
// user code
2 }
1
0
Interrupt Grouping
Interrupt Vector Table
Priority 255 void __interrupt(3) __bisr_(5) isrA()
{
// CCPN = 5, IE = 1
}
void __interrupt(4) __bisr_(5) isrB()
{
9
// CCPN = 5, IE = 1
8 }
7 void __interrupt(5) __bisr_(5) isrC()
{
6 j isrD
// CCPN = 5, IE = 1
5 j isrC }
Priority void __interrupt(6) isrD()
4 j isrB
Group {
3 j isrA
// CCPN = 6, IE = 0
2 }
1
0
Interrupt Routine Entry Point
OR
Begin Interrupt Vector
31 13 5 0
BIV x x x x x x x x x x x x x x x x x x x 0 0 0 0 0 0 0 0 x x x x 0
3 (256KByte)
2
BIV
1 8 words
0 8 words
Interrupt System Example(1)
MEMORY
Program (after)
Priority
Program (before)
N Jump ISR RFE
RFE
ISR
0 Program Program
Jump Prio N
IVT
BIV
10.02.2010 Copyright © Infineon Technologies 2010. All rights reserved. Page 50
Interrupt System Example(2)
Int. 8
ICR.CCPN 0 0 3 3 8 3 0
ICR.PIPN 0 3 0 8 0 0 0
PCXI.PCPN 0 0 0 0 3 0 0
ICR.IE 1 1 0 1 0 1 1
ISR 8
ISR 3 ISR 3
Main Main
Program Program
10.02.2010 Copyright © Infineon Technologies 2010. All rights reserved. Page 51
Interrupt System in TC1797
MPR
Code Protection MPX
Registers PRIV
MPN A9 GRWP
A8 Write with
A1 PSW.GW=0
Address 0
A0
access
10.02.2010 Copyright © Infineon Technologies 2010. All rights reserved. Page 59
Trap Class 2(Instruction Fetch)
MEM MEMORY
Invalid memory
address
(e.g. write on a
CSFR without mtcr)
ALN
Code Area
Access
link FCX
CSA 2
Call depth overflow: CDO
link
Call Depth underflow: CDU
CSA 3
Nesting error: NEST
link LCX
PCX = 0 CSU
FCX = 0 FCU
CAE
PIE
FPU DIE
64 bits 128 bits
PMI DMI
Bus system
Class 7 (NMI) :
– NMI Trap. (Watchdog timer error, PLL unlock, etc).
8 Words
7
8 Words
6
8 Words
5
8 Words
4
8 Words
3
No MMU in 8 Words
TC1797 2
8 Words
1
8 Words
BTV 0
Code
10.02.2010 Copyright © Infineon Technologies 2010. All rights reserved. Page 66
Trap Vector Table Entry
31 7 5 0
BTV 000 0
TCN
3-bit
OR
C V SV AV SAV res
15 11 10 0
IO = "00" User-0
IO = "01" User-1
IO = "10" Super-
visor
Address Space IV
PR Supervisor-only instructions
Segment 15 (MTCR, BISR, MMU instructions,
peripheral cache instructions)
P registers
Segment 14 MP
Segment 13
Segment 12
User-0
Segment 11
Segment 10
User-1
Segment 9
Segment 8 Super-
visor
Segment 7
Segment 6
Segment 5
Segment 4
Segment 3
Segment 2
IV
Segment 1 PR
enable or disable
Segment 0 the interrupt system
Segment 13
Segment 12 User-0
Segment 11 ac
ce
ss User-1
Segment 10
Segment 9
Segment 8 Super-
visor
Segment 7
Segment 6
Segment 5
Segment 4
Segment 3
Segment 2
Segment 1
enable or disable
Segment 0 the interrupt system
Segment 13
Segment 12 User-0
Segment 11
ac
ce User-1
Segment 10 ss
Segment 9
Segment 8 Super-
visor
Segment 7
Segment 6
Segment 5
Segment 4
Segment 3
Segment 2
Segment 1
enable or disable
Segment 0 the interrupt system
PSW:
Permission mode:
Data Range: Read enable, write
enable (or both)
Code Range: Instruction fetch
enable.
Upper bound 3
Data protection
register sets Mode 3
Range 3
Lower bound 3
Set 1
Upper bound 2
Set 0
Mode 2
Range 1
Lower bound 2
Range 1+2
Upper bound 1
Code protection
register sets Mode 1
Range 1
Lower bound 1
Set 1
Upper bound 0
Set 0
Mode 0 Range 0
Lower bound 0
Libraries Globals
read/write
“Owned” globals
for current task
Private code
for current task Static data and
static space
for current task
; TriCore assembler
ADDR CODE ASSEMBLER
00000000 C600 mov16 d15,#0 ; move constant 0 to d15
00000002 C050F27F0 lea a15,#999 ; loop count value
00000006 947F st16.w [a7+],d15 ; store value
00000008 C21F add16 d15,#1 ; value + 1
0000000A A4rFrrrrr st.w var_3,d15 ; store word
0000000E 5667 or16 d7,d6 ; bitwise OR
Absolute Addressing
4 14 14
00000000000000 32-bit address
; Example
; Variable in the first 16K
~ ~
; of a 256 MByte segment
ld.w d3,near_addr
16 KB
Segment base ~ ~
address
10.02.2010 Copyright © Infineon Technologies 2010. All rights reserved. Page 83
Addressing via long offset
16-bit offset
+ Base address
32-bit address
~ ~
; Example
; load word from a3 + 0x1000
; store word at a3 - 10000
movh.a a3,#@his(far_addr) Base address
lea a3,[a3]@los(far_addr) 64 KB
ld.w d3,[a3]0x1000
st.w [a3]-10000,d3
10-bit offset
+ Base address
32-bit address
~ ~
; Example 1 a3=0x80000100
ld.h d3,[a3]10 ; adr=0x8000010A
ld.b d3,[a3]-3 ; adr=0x800000FD