Title: Chapter 3 GeneralPurpose Processors: Software
1- Chapter 3 General-Purpose Processors Software
2Designing a General Purpose Processor
- Not something an embedded system designer
normally would do - But instructive to see how simply we can build
one top down - Remember that real processors arent usually
built this way - Much more optimized, much more bottom-up design
Declarations bit PC16, IR16 bit
M64k16, RF1616
3Architecture of a Simple Microprocessor
- Storage devices for each declared variable
- register file holds each of the variables
- Functional units to carry out the FSMD operations
- One ALU carries out every required operation
- Connections added among the components ports
corresponding to the operations required by the
FSM - Unique identifiers created for every control
signal
4A Simple Microprocessor
PCclr1
Reset
PC0
IRMPC PCPC1
MS10 Irld1 Mre1 PCinc1
Fetch
Decode
from states below
Mov1
RFrn Mdir
RFwarn RFwe1 RFs01 Ms01 Mre1
to Fetch
op 0000
Remember
You just built a simple microprocessor!
5A Simple Microprocessor
Reset
PC0
IRMPC PCPC1
Fetch
Decode
from states below
Mov1
RFrn Mdir
to Fetch
op 0000
What would the rest be?
Mov2
Mdir RFrn
0001
to Fetch
Mov3
Mrn RFrm
0010
to Fetch
Mov4
RFrn imm
0011
to Fetch
Add
RFrn RFrnRFrm
0100
to Fetch
if ALUs00 add if ALUs01 sub
Sub
RFrn RFrn-RFrm
0101
to Fetch
FSMD
6A Simple Microprocessor
PCclr1
Reset
PC0
IRMPC PCPC1
MS10 Irld1 Mre1 PCinc1
Fetch
Decode
from states below
RFwarn RFwe1 RFs01 Ms01 Mre1
Mov1
RFrn Mdir
to Fetch
op 0000
RFr1arn RFr1e1 Ms01 Mwe1
Mov2
Mdir RFrn
0001
to Fetch
RFr1arn RFr1e1 Ms10 Mwe1
Mov3
Mrn RFrm
0010
to Fetch
RFwarn RFwe1 RFs10
Mov4
RFrn imm
0011
to Fetch
RFwarn RFwe1 RFs00 RFr1arn
RFr1e1 RFr2arm RFr2e1 ALUs00
Add
RFrn RFrnRFrm
0100
to Fetch
RFwarn RFwe1 RFs00 RFr1arn
RFr1e1 RFr2arm RFr2e1 ALUs01
Sub
RFrn RFrn-RFrm
0101
to Fetch
PCld ALUz RFrlarn RFrle1
Jz
PC(RFrn0) ?rel PC
0110
to Fetch
FSM operations that replace the FSMD operations
after a datapath is created
FSMD
You just built a simple microprocessor!
7Chapter Summary
- General-purpose processors
- Good performance, low NRE, flexible
- Controller, datapath, and memory
- Structured languages prevail
- But some assembly level programming still
necessary - Many tools available
- Including instruction-set simulators, and
in-circuit emulators - ASIPs
- Microcontrollers, DSPs, network processors, more
customized ASIPs - Choosing among processors is an important step
- Designing a general-purpose processor is
conceptually the same as designing a
single-purpose processor
8Chapter 4
- Standard Single-purpose processors
9Introduction
- Single-purpose processors
- Performs specific computation task
- Custom single-purpose processors
- Designed by us for a unique task
- Standard single-purpose processors
- Off-the-shelf -- pre-designed for a common
task - a.k.a., peripherals
- serial transmission
- analog/digital conversions
10(No Transcript)
11(No Transcript)
12(No Transcript)
13Analog-to-digital converters
Assume your range starts at zero, then e/Vmax
d/(2n 1) Where e is the analog value, and d
is the digital value. If your range does not
start at zero, shift e and Vmax accordingly.
14Analog to Digital conversion using successive
approximation
Given an analog input signal whose voltage should
range from 0 to 15 volts, and an 8-bit digital
encoding, calculate the correct encoding for 5
volts. Then trace the successive-approximation
approach to find the correct encoding. 5/15
d/(28-1) d 85
Encoding 01010101
Successive-approximation method
½(Vmax Vmin) 7.5 volts Vmax 7.5 volts.
½(5.63 4.69) 5.16 volts Vmax 5.16 volts.
½(7.5 0) 3.75 volts Vmin 3.75 volts.
½(5.16 4.69) 4.93 volts Vmin 4.93 volts.
½(7.5 3.75) 5.63 volts Vmax 5.63 volts
½(5.16 4.93) 5.05 volts Vmax 5.05 volts.
½(5.63 3.75) 4.69 volts Vmin 4.69 volts.
½(5.05 4.93) 4.99 volts
15Analog-to-digital converters
Successive Approximation gives you an idea of how
one type of A/D works, but the easiest way to
calculate values is to use e/Vmax d/(2n
1) Example You have a 12 bit A/D and the range
of the A/D is -1V to 1V. If the output of the
A/D is 001010111111 what analog voltage is at
the input?
16Analog-to-digital converters
Example You have a 12 bit A/D and the range of
the A/D is -1V to 1V. If the output of the A/D
is 001010111111 what analog voltage is at the
input? We are trying to determine the analog
input which is e. e/Vmax d/(2n 1) e/(1
(-1)) d/(2n 1) note the range is shifted by
1V d 001010111111 703 n 12 2n
4096 e/2 703/(4096 1) 703/4095
0.1716722 e 0.343345 shifted back e -1
0.343345 -0.656654
17Digital to Analog converters
- Quite Simply, the go the opposite direction of
ADCs. - You send it a digital value, and it produces an
analog voltage proportional to that value. - Among other things, DACs are critical to audio
components that store the media in digital format.
18In-Class Exercises
- You have a 4-bit ADC which has an input range
from 2V to 3V. It is sending the value 1110.
What is the analog input? - Can you determine the tolerance (ie accuracy) of
you answer?
19In-Class Exercises
- You have a 4-bit ADC which has an input range
from 2V to 3V. It is sending the value 1110.
What is the analog input? Can you determine the
tolerance (ie accuracy) of you answer? - e/V d(2n-1) e/(3-2) 14/15 e0.93
- shifted back e 2.93V
- The tolerance is basically the /- ½(resolution)
- The resolution is the smallest change the A/D can
measure (or resolveget it?) - For this example the resolution is 1/15 1
0.067V (smallest digital step range) - So, the accuracy is /- 0.034V
20To Do Before Next Class
- Get to work on HW3 if you havent already.