1
00:00:00,720 --> 00:00:01,310
Hello.

2
00:00:01,380 --> 00:00:02,290
Welcome back.

3
00:00:02,310 --> 00:00:04,760
In this lesson we should talk about registers.

4
00:00:04,920 --> 00:00:09,360
Registers are just the most fundamental storage area on the chip.

5
00:00:09,420 --> 00:00:12,220
You can put almost anything you want on a register.

6
00:00:12,220 --> 00:00:19,100
Data Values like time of values COUNTER LIST tables and so on and so forth.

7
00:00:19,260 --> 00:00:22,950
Process or solve a number of registers inside a process of call.

8
00:00:23,010 --> 00:00:28,050
And most of these registers are grouped in a unit known as the register bank.

9
00:00:28,540 --> 00:00:39,000
The 70 PMI process has a total of 37 registers and 30 of these registers general purpose registers six

10
00:00:39,000 --> 00:00:45,810
of them are status registers and one is the program counsel register the arms of registers are arranged

11
00:00:45,840 --> 00:00:54,700
in partially over Lapin banks meaning you as the program I see a different register bank for each process

12
00:00:54,700 --> 00:00:55,650
or mode.

13
00:00:55,650 --> 00:01:02,310
Sometimes this creates a bit of confusion but it shouldn't really simply put out at any time.

14
00:01:02,310 --> 00:01:09,690
Fifteen general purpose registers 1 or 2 status registers an AR 15 which is known as the program counter

15
00:01:09,690 --> 00:01:11,940
register visible to you.

16
00:01:11,940 --> 00:01:18,120
Ask the programmer you always programmed these registers using the same name but dependent on which

17
00:01:18,120 --> 00:01:19,410
mode you are in.

18
00:01:19,430 --> 00:01:25,180
You are simply looking at different sets of registers as you can see here.

19
00:01:25,380 --> 00:01:33,510
They use a mode over here you have our issue through our 14 program counter register and a current program

20
00:01:33,510 --> 00:01:36,770
status register C P S R for sure.

21
00:01:37,020 --> 00:01:38,910
This is what the end of the table looks like.

22
00:01:38,940 --> 00:01:44,360
Actually so as you can see there CPS are actually this a smaller version of the tables.

23
00:01:44,460 --> 00:01:45,660
Let's use this one.

24
00:01:45,660 --> 00:01:52,290
If the process are way to suddenly change to the abort mode for whatever reason it would swap or bank

25
00:01:52,350 --> 00:01:59,330
out registers are 13 and are 14 with different r 13 and our 14 registers.

26
00:01:59,460 --> 00:02:06,750
Notice that the largest register swaps occurs when the processor changes to the fast interrupt mode.

27
00:02:06,750 --> 00:02:13,200
This is partly because the processor is trying to do everything very quickly saved a state of the machine

28
00:02:13,290 --> 00:02:15,830
and restore a new state during an interrupt.

29
00:02:15,840 --> 00:02:22,440
It is normally necessary to drop everything the process is doing and begin to work on one task and this

30
00:02:22,440 --> 00:02:29,690
involves even the state of the machine in transition to handling the interrupt very quickly rather than

31
00:02:29,690 --> 00:02:35,220
moving the data from all the registers on the processor to extend or memory.

32
00:02:35,260 --> 00:02:42,960
The machine simply swapped certain registers with new ones to allow the programmer access to fresh registers.

33
00:02:43,020 --> 00:02:50,490
I know this may sound a bit unusual but way to get to the section on exception handling the banked registers.

34
00:02:50,670 --> 00:02:56,370
Those cheated Gray they are available when the processor is in a particular mode.

35
00:02:56,370 --> 00:03:00,590
For example sports mode has banked registers are 13.

36
00:03:00,620 --> 00:03:05,850
I bought an AR 14 I bought and SPDR I bought.

37
00:03:05,850 --> 00:03:12,420
As you can see every process or more would accept the use a mode can change mode by writing directly

38
00:03:12,420 --> 00:03:20,460
to the the mode bit of the CPRS register which we shall examine later or process and modes accept the

39
00:03:20,460 --> 00:03:28,930
system mode have a set of Associated Bank registers that are a subset of the main 16 registers at bank

40
00:03:28,950 --> 00:03:32,910
register maps one to one onto the user mode register.

41
00:03:32,910 --> 00:03:39,540
So if you change the process a mode at bank register from the new mode will replace the existing register.

42
00:03:39,540 --> 00:03:45,360
While most of the registers can be used for any purpose there are a few registers that are normally

43
00:03:45,360 --> 00:03:47,370
used for special purposes.

44
00:03:47,400 --> 00:03:54,120
R 13 is known as the stock pointer register and it hosted the address of the stack in memory and a unique

45
00:03:54,120 --> 00:03:56,680
stack pointer exist for each mode.

46
00:03:56,820 --> 00:04:05,900
We shall examine this incoming lessons our 14 is known as the link register and it is used to hold these

47
00:04:05,910 --> 00:04:13,200
subroutine or exception return address AR 15 hosted the program counter and we shall we shall see the

48
00:04:13,310 --> 00:04:14,660
at the end of this section.

49
00:04:14,660 --> 00:04:23,940
Both the 70 PMI and the Caltex pipeline architectures meaning that while one instruction is being fetched

50
00:04:24,410 --> 00:04:29,100
another is being decoded and yet another is being executed.

51
00:04:29,100 --> 00:04:34,920
The address of the instruction that is being fetched is contained in this AR 15 known as the program

52
00:04:34,920 --> 00:04:36,340
counter register.

53
00:04:36,420 --> 00:04:44,430
You ask the programmer once normally access this register on less than certain specific cases where

54
00:04:44,730 --> 00:04:51,990
let's say you need to jump to a particular memory location or when you want to recover to a different

55
00:04:51,990 --> 00:04:54,550
destination after an interrupt.

56
00:04:54,570 --> 00:04:57,460
We shall experiment with all of these later.

57
00:04:57,540 --> 00:05:04,210
The CPS R is also known as the the current program status register and can be seen as a state of the

58
00:05:04,210 --> 00:05:13,240
system allowing the program to recover from exceptions or branch on the result or an operation it contains

59
00:05:13,240 --> 00:05:19,770
condition flags interrupt flags the current mode and the current state.

60
00:05:19,840 --> 00:05:26,820
Each privileged state has a saved program status register as we can see in the diagram here.

61
00:05:26,830 --> 00:05:30,570
Each privilege mode has its own SPSS.

62
00:05:30,650 --> 00:05:40,050
The supervisor has SPSS R as FEC a poor test S P S R a port on defined whose spirits are undefined etc.

63
00:05:40,290 --> 00:05:49,330
The SPSS R is used to save the value of the CPS R when an exceptional case since use a mode and system

64
00:05:49,330 --> 00:05:52,250
mode are not entered on any exception.

65
00:05:52,270 --> 00:06:00,560
They do not have an espresso and a register to preserve CPS are is not required for these modes.

66
00:06:00,670 --> 00:06:07,270
Actually in the use of motor system would if you attempt to read DSP SPSS you will get on an unpredictable

67
00:06:07,270 --> 00:06:09,700
value back meaning the data cannot be used.

68
00:06:09,760 --> 00:06:15,550
And if you attempt to write to the SPSS register in one of these most that data will be ignored.

69
00:06:15,550 --> 00:06:22,900
These four bits at the top here are collectively known as the condition code flags and the 8 bits at

70
00:06:22,900 --> 00:06:29,470
the bottom also a condition could fly can be altered by the arithmetic and logical instructions such

71
00:06:29,470 --> 00:06:33,830
as subtraction addition logical shift etc..

72
00:06:33,850 --> 00:06:37,990
We shall examine the meaning and relevance of these in our code.

73
00:06:37,990 --> 00:06:40,520
The F and a bit here.

74
00:06:40,540 --> 00:06:45,980
The interrupt to disable bits which disable the fast interrupt in the normal interrupt.

75
00:06:46,150 --> 00:06:54,010
If the asset the TBD is known as the status bit and it is used to indicate the state of the system so

76
00:06:54,010 --> 00:07:00,250
you ask the programmer will only read this bit not right to it as we shall see later.

77
00:07:00,250 --> 00:07:06,970
There is a different requirement associated with this bit when it comes to the cortex and architecture.

78
00:07:07,300 --> 00:07:13,330
If the bit is set to one it means the core is executed and in thump mode.

79
00:07:13,630 --> 00:07:16,470
The list significant bits are used to set the.

80
00:07:16,510 --> 00:07:18,260
The mode of the processor.

81
00:07:18,310 --> 00:07:22,740
When bit 4 through 0 are set at 1 serious serious serious 0.

82
00:07:22,930 --> 00:07:26,480
Then the process is set to operate and use a mode in the same way.

83
00:07:26,500 --> 00:07:30,390
When these bits set at 1 0 0 0 1.

84
00:07:30,490 --> 00:07:38,020
Then the process operate and fast interrupt mode and in the same way when all four data set when 0 5

85
00:07:38,070 --> 00:07:40,140
bits remember its bid for 3 0.

86
00:07:40,180 --> 00:07:47,910
So when all 5 bits are set at 1 1 1 1 1 then the system is operating in the system mode.

87
00:07:48,190 --> 00:07:52,060
So this all there is to it and I'll see you in the next lesson.
