ECE/CS 3724 - Microprocessors: Computer
ECE/CS 3724 - Microprocessors: Computer
Everything relating to the class is posted on: http://www.ece.msstate.edu/~reese/EE3724 Most of the course lecture notes are linked to WWW page -- print them out before class and bring them to lecture Be sure to read the class Policy/Syllabus, and follow the link to the EE 3724 LAB page Lots of material in this class - dont fall behind!
BR 6/00
Another approach is to design a logic network that can used to solve many different problems
This general purpose logic network might not be as efficient (speed, cost) as a special purpose logic network, but hopefully can be used to solve multiple problems!
BR 6/00 2
A Computer!!
A Computer is a digital system whose operation can be specified via a Program .
Changing the program changes the computer behavior! (solves a different problem!!!).
A Program is simply a sequence of binary codes that represent instructions for the computer. The Program is stored in a Memory . External inputs to the Computer can also alter the behavior the computer. The computer will have Outputs that can be set/reset via program instructions.
These external inputs/output are know as the I/O section of the computer. 6/00 BR
3
Input/Output devices
BR 6/00 4
Problem Definition
Build a Digital System based upon your Social Security number (SSN). The Digital System will have one external input called ODD. If ODD is true, then the system will reset to display the LEFTMOST odd digit in your SSN, and then the output will sequence over the odd digits in your SSN, skipping over the even digits. If ODD is false, then the system will reset to display the LEFTMOST even digit in your SSN, and then the output will sequence over the even digits in your SSN, skipping over the odd digits.
BR 6/00
Output s
Memory Element
Computer System Will only work for any SSN sequence, change program to change sequence
C o n t r o l
Input/Output devices
6
BR 6/00
S0
S1 S2 S3
FSM Implementation
Use 3 D-FFs for the 8 states. Use Binary State Encoding: S0=000, S1=001, S2=010, etc S7 = 111 Odd
Combinational Logic Circuit 3-bit Present State Value 3
Dffs
Ssn[3:0]
Outputs
3 Q R D
Alcr
BR 6/00 8
Odd
ssn[3:0] - 4 bit output bus that has the value of the ssn digit odd 1 bit input that controls whether or not even or odd sequence is displayed BR 6/00
ssn[3:0]
Odd
aclr
Register loads DIN on rising clock edge when ld = 1. Aclr is an asynchronous clear.
BR 6/00 10
ssn[3:0]
Odd
Address[?:0] M E M Data[?:0]
Memory is KxN (K locations, each location N bits wide). Dont know values of K, N yet.
BR 6/00 11
ssn[3:0]
R E G
Odd
Din[?:0] ? ld en aclr c n t r
ld aclr
Addr[?:0]
M E M
Data[?:0]
Counter increments on rising clock edge when en = 1. Loads on rising clock edge when ld = 1. Aclr is an asynchronous clear.
BR 6/00 12
13
Needed Instructions
1. Jc location Jump conditionally If odd = 1, then jump to location (counter set equal to specified location). If odd = 0, then fetch next instruction (counter increments by 1). 2. Jmp location Jump unconditional Fetch next instruction from location (counter loaded with specified location). out data load output register with data. Used for setting the ssn[3:0] value.
3.
BR 6/00
14
Instruction Encoding
The binary encoding for instructions is usually divided into different fields; with each field representing part of the information needed by the instruction. Our instructions require two fields: Operation Code and Data Opcode | Data How many bits for the Opcode? Have 3 instructions, need at least 2 bits! (2 bits can encode 22 items) How many bits for Data? The data field must specify the 4 bits for the SSN number, and also specify a memory location. For now, lets use 4 bits for data. Instruction is 6 bits total. I5 I4 I3 I2 I1 I0 Opcode | Data
BR 6/00 15
Instruction Table
I5 I4 JMP location JC location OUT data 00 01 10 | | | I3 I2 I1 I0 4-bit location 4-bit location 4-bit data
Note that Opcode = 11 is unused. Also, the opcode assignments were arbitrary; we could have easily chosen some other assigment (such as OUT=00, JC=00, JMP=01)
BR 6/00 16
Start:
17
BR 6/00
18
ssn[3:0] 4
4 ld en aclr
c n t r
Addr[3:0]
M E M
Data[5:0]
Data[5:4]
BR 6/00
19
r_ld <= 1 when ( op = 10) else 0; When does Counter Load? When JMP instruction (OP=00) or when JC instruction and Odd = 1!!!! c_ld <= 1 when ( op=00 or (op = 01 and odd=1)) else 0; When does counter increment? When NOT Loading!! c_en <= not (c_ld);
BR 6/00 20
c_ld <= ( (not op(1)) and (not op(0)) or ( (not op(1)) and op(0) and odd)); c_en <= not (c_ld);
BR 6/00
21
Timing
CLK Aclr Abus Dbus r_ld c_ld odd SSN 0 4 8
BR 6/00
0
010111
1
100100
2
101000
3
100000
4
100010
5
101000
6
000000
0
010111
7
100101
8
22
Timing (cont.)
CLK Aclr Abus Dbus r_ld c_ld odd SSN 2 8 5
BR 6/00
5
101000
6
000000
0
010111
7
100101
8
100111
9
100001
A
101001
B
000000
0
010111
9
23
Comments
Notice that the aclr line forces the processor to fetch its first instruction from location 0.
All processors have a RESET line like this to force the first instruction fetch from a particular location.
Notice that execution never stops!!! Processor is always fetching, executing instructions! Called the Fetch,Execute loop. Must make sure that memory is loaded with valid instructions BEFORE execution starts!!!
BR 6/00
24
Instruction Pointer
The counter in this processor is a special purpose register that exists in one form or another in every processor Usually is called the Instruction Pointer (IP) register or Program Counter (PC) register. This register contains the address of the next instruction to be fetched.
Normal operation is to fetch very next instruction in memory Jump instructions change the IP value so that fetch occurs from some non-sequential memory location
BR 6/00
25
Implementation Comparisons
FSM Implementation
Only 3 D-FFs + combinational logic Will only do one SSN sequence Will operate a faster clock rate than Processor implementation because of simpler logic
Processor Implementation
Many more gates needed than FSM implementation Will execute at a slower clock rate than FSM General purpose: can implement any SSN sequence by simply changing program.
MANY applications are better suited for implementation by general purpose digital systems (Processors) than by dedicated logic
BR 6/00 26
Vocabulary
Address bus input bus to memory device specifying location of data to read/write Data bus input/output bus to memory device containing data value being read or written. Instruction Pointer special register in a processor specifying address of next instruction to be executed. Instruction Mnemonic the ascii representation of an instruction (I.e., OUT 4). Machine Code the binary representation of an instruction (I.e OUT 4 = 010100)
BR 6/00 27
Vocabulary (cont.)
Operation code (Op code) the part of the machine code for an instruction that tells what the instruction is ( JMP = 00). Assembly the process of converting instructions to their machine code representation OUT 4 10 0100 Disassembly the process of converting machine code to its instruction mnemoic 10 0100 OUT 4 Fetch/Execute - what processors do all day long (fetch instruction from memory, execute it).
BR 6/00 28
BR 6/00
29
BR 6/00
30
10