Microprocessor Systems: Lecture 1: Course Overview Digital Logic Review

Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

ECE 234

Microprocessor Systems

Lecture 1: Course overview; Digital logic review

Dr. John Lynch


School of Engineering and Computer Science

2
Course Objectives
 Objectives
 Learn to design microprocessor systems that include both
hardware and software components
 Microprocessor system architecture and instruction sets
 Assembly language programming
 Control flow instructions and iteration
 Complex instructions, such as repetition, loops
 Interrupt handling
 Design hardware interfaces to external devices and write software
to control them
 Understand hardware-software tradeoffs
 Prerequisites:
 Ability to design, code, and debug computer programs written
in C language (CS 251)
 Ability to design, implement, and debug simple logic circuits
(ECE 214)

ECE 234

1
3
ECE 234 Weekly Schedule
Monday Lab Reading, Wednesday Lecture
Week
Date Topic Homework Date Topic
Course introduction; digital
1 10-Jan Ch. 1, 2 12-Jan The stored program machine
circuit review
2 17-Jan NO CLASS – MLK Jr. Holiday Ch. 3 19-Jan Introduction to PIC24 microcontroller
8/16-bit Operations in PIC24 Assembly
3 24-Jan MPLAB introduction Ch. 4 26-Jan
Language
Extended Precision and Signed
4 31-Jan 8/16-bit unsigned operations Ch. 5 2-Feb
Operations in PIC24 Assembly Language
5 7-Feb 16/32-bit signed operations --- 9-Feb Test – covers Ch. 1 - 5
NO CLASS – President‟s Day
6 14-Feb Ch. 6 16-Feb Pointers and Subroutines
Holiday
7 21-Feb Pointers and subroutines 23-Feb PIC24 Microcontroller Start-up
Ch. 8
8 28-Feb PIC24 System Startup 2-Mar PIC24 Parallel Port I/O
9 7-Mar LED/Switch I/O --- 9-Mar Test – covers Ch. 6 - 8
SPRING VACATION
10 21-Mar No Lab Ch. 9 23-Mar Interrupts and a First Look at Timers
11 28-Mar Interrupts and Timers 30-Mar Asynchronous Serial I/O
Ch. 10
12 4-Apr Serial I/O, EEPROM 6-Apr SPI, I2C Serial IO
13 11-Apr ADC, DAC Experiments Ch. 11 13-Apr ADC, DAC Operation
Timers: Output Compare, Input Capture,
14 18-Apr PWM experiments Ch. 12 20-Apr
Timekeeping
15 25-Apr Term paper presentations --- 27-Apr Review for final exam
16 FINAL EXAM - date TBA

ECE 234

Course Contact Info


 Course Angel web site: http://lms.wsu.edu/
 Lecture notes
 Announcements
 Assignments
 Drop boxes for completed work

 Instructor
 Dr. John Lynch
 Email: [email protected]
 Tel: 360-546-9252
 Office hours: Anytime VELS 130M

ECE 234

2
5
Course Follows the Required Text
 R. Reese, J.W. Bruce and B. Jones,
Microcontrollers, From Assembly Language to C Using the PIC24 Family,
Cengage Learning 2009, ISBN 978-1-5845-0583-9
http://www.reesemicro.com/
 Developed from a course at Mississippi State University
http://www.ece.msstate.edu/wiki/index.php/ECE3724_Microprocessors#C
ourse_summary
 Use PIC24 microcontroller
 Early labs involve assembly
language programming
 Later labs use C programs to
operate PIC24 peripherals
 The first hardware lab constructs
a simple PIC24-based system
from scratch
 Subsequent hardware labs build
on this design

http://www.reesemicro.com/Home/Course

ECE 234

6
Grading
 Homework (due every Wednesday) 15%
 Labs (report due every Monday) 40%
 Mid-term exams (2) 20%
 Final exam (comprehensive) 15%
 Term paper and presentation 10%

ECE 234

3
7
Combinational Logic Review
 How much of ECE 214 do you remember?
 Today‟s review should help you remember
 If I go too fast…
 Ask QUESTIONS during CLASS to SLOW things down

ECE 234

8
Binary Representation
 The basis of all digital data is binary representation.
 Binary - means „two‟
 1, 0
 True, False
 Hot, Cold
 On, Off
 We must be able to handle more than just values for real
world problems
 1, 0, 56
 True, False, Maybe
 Hot, Cold, LukeWarm, Cool
 On, Off, Leaky

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

4
9
Number Systems
 To talk about binary data, we must first talk about number
systems
 The decimal number system (base 10) you should be
familiar with!
 A digit in base 10 ranges from 0 to 9.
 A digit in base 2 ranges from 0 to 1 (binary number system).
A digit in base 2 is also called a „bit‟.
 A digit in base R can range from 0 to R-1
 A digit in Base 16 can range from 0 to 16-1
(0,1,2,3,4,5,5,6,7,8,9,A,B,C,D,E,F). Use letters A-F to
represent values 10 to 15. Base 16 is also called Hexadecimal
or just „Hex‟.

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

10
Positional Notation
 Value of number is determined by multiplying each digit by
a weight and then summing. The weight of each digit is a
POWER of the BASE and is determined by position.

953.78 = 9 * 102 + 5 * 101 + 3 * 100 + 7 * 10-1 + 8 * 10-2


= 900 + 50 + 3 + .7 + .08
= 953.78

0b1011.11 = 1*23 + 0*22 + 1*21 + 1*20 + 1*2-1 + 1*2-2


= 8 + 0 + 2 + 1 + 0.5 + 0.25
Indicates = 11.75
Binary

0xA2F = 10*162 + 2*161 + 15*160


= 10 * 256 + 2 * 16 + 15 * 1
Indicates = 2560 + 32 + 15 = 2607
Hexadecimal

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

5
11
Base 10, Base 2, Base 16
 The textbook uses subscripts to represent different bases
(i.e. A2F16 , 953.7810 , 1011.112 )
 Special symbols represent the different bases. The default
base will be decimal, no special symbol for base 10.
 The „0x‟ will be used for base 16 ( 0xA2F)
The „0b‟ will be used for base 2 (0b10101111)

If ALL numbers on a page are the same base (ie, all in base
16 or base 2 or whatever) then no symbols will be used and
a statement will be present that will state the base (ie, all
numbers on this page are in base 16).

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

12
Common Powers
2-3 = 0.125
2-2 = 0.25 160 = 1 = 20
2-1 = 0.5 161 = 16 = 24
20 = 1 162 = 256 = 28
21 = 2 163 = 4096 = 212
22 = 4
23 = 8
24 = 16
25 =32
26 = 64
27 = 128
28 = 256 210 = 1024 = 1 K
29 = 512 220 = 1048576 = 1 M (1 Mega) = 1024 K = 2 10 * 210
210 = 1024 230 = 1073741824 = 1 G (1 Giga)
211 = 2048
212 = 4096

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

6
13
Conversion of Any Base to Decimal
Converting from ANY base to decimal is done by multiplying each
digit by its weight and summing.

Binary to Decimal

0b1011.11 = 1*23 + 0*22 + 1*21 + 1*20 + 1*2-1 + 1*2-2


= 8 + 0 + 2 + 1 + 0.5 + 0.25
= 11.75

Hex to Decimal

0xA2F = 10*162 + 2*161 + 15*160


= 10 * 256 + 2 * 16 + 15 * 1
= 2560 + 32 + 15 = 2607

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

Conversion of Decimal Integer


To ANY Base
Divide Number N by base R until quotient is 0. Remainder at
EACH step is a digit in base R, from Least Significant digit to Most
significant digit.

Convert 53 to binary
53/2 = 26, rem = 1 Least Significant Digit
26/2 = 13, rem = 0
13/2 = 6 , rem = 1
6 /2 = 3, rem = 0
3/2 = 1, rem = 1
1/2 = 0, rem = 1

53 = 0b 110101 Most Significant Digit


= 1*2 + 1*2 + 0*2 + 1*2 + 0*21 + 1*20
5 4 3 2

= 32 + 16 + 0 + 4 + 0 + 1 = 53

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

7
Least Significant Digit 15
Most Significant Digit

53 = 0b 110101

Most Significant Digit Least Significant Digit


(has weight of 25 or 32). (has weight of 20 or 1).
For base 2, also called For base 2, also called
Most Significant Bit Least Significant Bit
(MSB). Always (LSB). Always
LEFTMOST digit. RIGHTMOST digit.

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

16
Hex (base 16) to Binary Conversion
Each Hex digit represents 4 bits. To convert a Hex number to
Binary, simply convert each Hex digit to its four bit value.

Hex Digits to binary:


0x0 = 0b 0000 Hex Digits to binary (cont):
0x9 = 0b 1001
0x1 = 0b 0001
0xA = 0b 1010
0x2 = 0b 0010
0xB = 0b 1011
0x3 = 0b 0011
0xC = 0b 1100
0x4 = 0b 0100
0xD = 0b 1101
0x5 = 0b 0101
0xE = 0b 1110
0x6 = 0b 0110
0xF = 0b 1111
0x7 = 0b 0111
0x8 = 0b 1000

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

8
17
Hex to Binary, Binary to Hex

0xA2F = 0b 1010 0010 1111

0x345 = 0b 0011 0100 0101

Binary to Hex is just the opposite, create groups of 4 bits


starting with least significant bits. If last group does not have
4 bits, then pad with zeros for unsigned numbers.

0b 1010001 = 0b 0101 0001 = 0x51

Padded with a zero

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

18
Binary Arithmetic, Subtraction
The rules for binary arithmetic are: The rules for binary subtraction are:

0 + 0 = 0, carry = 0 0 - 0 = 0, borrow = 0
1 + 0 = 1, carry = 0 1 - 0 = 1, borrow = 0

0 + 1 = 1, carry = 0 0 - 1 = 1, borrow = 1

1 + 1 = 0, carry = 1 1 - 1 = 0, borrow = 0

Borrows, Carries from digits to left of current of digit.


Binary subtraction, addition works just the same as
decimal addition, subtraction.

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

9
19
Binary, Decimal addition

Decimal
0b 101011
34 + 0b 000001
+ 17 ---------------
------ 101100
51
From LSB to MSB:
from LSD to MSD: 1+1 = 0, carry of 1
7+4 = 1; with carry out of 1 1 (carry)+1+0 = 0, carry of 1
to next column 1 (carry)+0 + 0 = 1, no carry
1 +0 = 1
0+0=0
1 (carry) + 3 + 1 = 5. 1+0=1
answer = 51.
answer = % 101100

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

20
Subtraction
Decimal Binary

900 0b 100
- 001 - 0b 001
------- -------
899 011

0-1 = 9; with borrow of 1 0-1 = 1; with borrow of 1


from next column from next column
0 -1 (borrow) - 0 = 9, with 0 -1 (borrow) - 0 = 1, with
borrow of 1 borrow of 1
9 - 1 (borrow) - 0 = 8. 1 - 1 (borrow) - 0 = 0.
Answer = 899. Answer = % 011.

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

10
21
Hex Addition

Decimal check.
0x3A
+ 0x28 0x3A = 3 * 16 + 10
-------- = 58
0x62 0x28 = 2 * 16 + 8
= 40
A+8 = 2; with carry out of 1 58 + 40 = 98
to next column
0x62 = 6 * 16 + 2
1 (carry) + 3 + 2 = 6. = 96 + 2 = 98!!
answer = 0x62

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

22
Hex addition again
Why is 0xA + 0x8 = 2 with a carry out of 1?

The carry out has a weight equal to the BASE (in this case
16). The digit that gets left is the excess (BASE - sum).

Ah + 8h = 10 + 8 = 18.
18 is GREATER than 16 (BASE), so need a carry out!
Excess is 18 - BASE = 18 - 16 = 2, so „2‟ is digit.
Exactly the same thing happens in Decimal.
5 + 7 = 2, carry of 1.
5 + 7 = 12, this is greater than 10!.
So excess is 12 - 10 = 2, carry of 1.

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

11
23
Hex Subtraction

Decimal check.
0x34
- 0x27 0x34 = 3 * 16 + 4
-------- = 52
0x0D 0x27 = 2 * 16 + 7
= 39
4-7 = D; with borrow of 1 52 - 39 = 13
from next column
0x0D = 13 !!
3 - 1 (borrow) - 2 = 0.
answer = 0x0D.

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

24
Hex subtraction again

Why is 0x4 – 0x7 = 0xD with a borrow of 1?

The borrow has a weight equal to the BASE (in this case 16).

BORROW +0x4 – 0x7 = 16 + 4 -7 = 20 -7 = 13 = 0xD.


0xD is the result of the subtraction with the borrow.
Exactly the same thing happens in decimal.
3 - 8 = 5 with borrow of 1
borrow + 3 - 8 = 10 + 3 - 8 = 13 - 8 = 5.

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

12
25
Fixed Precision
With paper and pencil, I can write a number with as many digits as I
want:
1,027,80,032,034,532,002,391,030,300,209,399,302,992,092,920

A microprocessor or computing system usually uses FIXED


PRECISION for integers; they limit the numbers to a fixed number
of bits:

0x AF4500239DEFA231 64 bit number, 16 hex digits


0x 9DEFA231 32 bit number, 8 hex digits
0x A231 16 bit number, 4 hex digits
0x 31 8 bit number, 2 hex digits

High end microprocessors use 64 or 32 bit precision; low end


microprocessors use 16 or 8 bit precision.

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

26
Unsigned Overflow

This class will use 8 bit precision most of the time, 16 bit
occasionally.

Overflow occurs when I add or subtract two numbers, and the


correct result is a number that is outside of the range of
allowable numbers for that precision. I can have both unsigned
and signed overflow (more on signed numbers later)

8 bits -- unsigned integers 0 to 28 -1 or 0 to 255.


16 bits -- unsigned integers 0 to 216-1 or 0 to 65535

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

13
27
Unsigned Overflow Example
Assume 8 bit precision; ie. I can‟t store any more than 8 bits for
each number.
Lets add 255 + 1 = 256. The number 256 is OUTSIDE the
range of 0 to 255! What happens during the addition?

255 = 0x FF
/= means Not Equal
+ 1 = 0x 01
-------------------
256 /= 0x00

0xF + 1 = 0, carry out


0xF + 1 (carry) + 0 = 0, carry out
Carry out of MSB falls off end, No place to put it!!!
Final answer is WRONG because could not store carry out.

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

28
Unsigned Overflow

A carry out of the Most Significant Digit (MSD) or Most Significant


Bit (MSB) is an OVERFLOW indicator for addition of UNSIGNED
numbers.
The correct result has overflowed the number range for that
precision, and thus the result is incorrect.
If we could STORE the carry out of the MSD, then the answer
would be correct. But we are assuming it is discarded because of
fixed precision, so the bits we have left are the incorrect answer.

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

14
29
Binary Codes
 N bits (or N binary Digits) can represent 2N different values.
 (for example, 4 bits can represent 24 or 16 different values)

N bits can take on unsigned decimal values from 0 to 2 N-1.


 Codes usually given in tabular form.

000 black
001 red
010 pink
011 yellow
100 brown
101 blue
110 green
111 white

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

30
Codes for Characters
Also need to represent Characters as digital data.
The ASCII code (American Standard Code for Information
Interchange) is a 7-bit code for Character data. Typically 8
bits are actually used with the 8th bit being zero or used for
error detection (parity checking).
8 bits = 1 Byte.

„A‟ = % 01000001 = 0x41


„&‟ = % 00100110 = 0x26

7 bits can only represent 27 different values (128). This


enough to represent the Latin alphabet (A-Z, a-z, 0-9,
punctuation marks, some symbols like $), but what about
other symbols or other languages?

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

15
31
ASCII

American Standard
Code for Information
Interchange

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

32
UNICODE
UNICODE is a 16-bit code for representing alphanumeric data. With
16 bits, can represent 216 or 65536 different symbols.
16 bits = 2 Bytes per character (the extended version uses 32-bits
per character, or 4 bytes, for 4,294,967,296 different symbols).
0x0041-005A A-Z
0x0061-007A a-z
Some other alphabet/symbol ranges
0x0400-04FF Cyrillic (Russian)
0x0590-05FF Hebrew
0x0600-06FF Arabic
0x0900-097F Devanagari (Hindi)
0x1100-11FF Hangul (Korean)
0x3040-31FF Hiragana, Katakana (Japanese)

UNICODE used by Web browsers, Java, most software these days.

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

16
33
Basic Logic Gates

Copyright 2005. Thomson/Delmar Learning, All rights reserved.


ECE 234

34
Majority Gate (and-or) form

Copyright 2005. Thomson/Delmar Learning, All rights reserved.


ECE 234

17
35
DeMorgan‟s Law

Copyright 2005. Thomson/Delmar Learning, All rights reserved.


ECE 234

36
Majority Gate (nand-nand) form

Copyright 2005. Thomson/Delmar Learning, All rights reserved.


ECE 234

18
37
Representing „1‟ and „0‟
 In the electrical world, two ways of representing
„0‟ and „1‟ are (these are not the only ways):
 Presence or absence of electrical current
 Different Voltage levels
 Different voltage levels are the most common
 Usually 0v for logic „0‟, some non-zero voltage for
logic „1‟ (I.e. > 3 volts)
 Can interface external sources to digital systems
in many ways
 Switches, buttons, other human controlled input devices
 Transducers (change a physical quantity like
temperature into a digital quantity).

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

38
Switch Inputs
High True switch Vdd is power
supply voltage,
Vdd Vdd
typically 5V or
3.3V

L H

Gnd is 0 V

Gnd Switch open (negated), Gnd Switch closed (asserted),


output is L output is H

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

19
39
Examples of high, low signals
Vdd Low True switch Vdd

H L

Gnd Gnd

Switch open (negated), Switch closed (asserted),


output is H output is L

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

40
CMOS Transistors (P, N)

S: source
G: gate
D: drain

transistor
operation of P, N
types is
complementary
to each other

Copyright 2005. Thomson/Delmar Learning, All rights reserved.


ECE 234

20
41
Inverter gate - takes 2 Transistors

PMOS is open
(off) PMOS is closed
(on)

NMOS is Closed NMOS is Open


(on) (off)

Copyright 2005. Thomson/Delmar Learning, All rights reserved.


ECE 234

42
Buffer - takes 4 Transistors

In digital logic, NMOS must be connected to ground,


PMOS to VDD.
Copyright 2005. Thomson/Delmar Learning, All rights reserved.
ECE 234

21
43
NAND gate - takes 4 Transistors

A B Y
L L H
L H H
H L H
H H L

A B Y
0 0 1
0 1 1
1 0 1
1 1 0

Copyright 2005. Thomson/Delmar Learning, All rights reserved.


ECE 234

44
How do we make an AND gate?
The only way with CMOS transistors is to connect an inverter
after a NAND gate.

Takes 6 transistors! In CMOS technology, NAND gates are


preferable to AND gates because they take less transistors,
are faster, and consume less power.
Copyright 2005. Thomson/Delmar Learning, All rights reserved.
ECE 234

22
45
Tri State Buffer
There is another way to drive a line or bus from multiple
sources. Use a TRISTATE buffer.

EN EN

A Y
A Y

When EN = 1, then Y = A.
When EN = 0, then Y = ??????
Y is undriven, this is called the high impedance state.
Designate high impedance by a „Z‟.
When EN = 0, then Y = „Z‟ (high impedance)

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

46
Using TriState Buffers
Only A or B is enabled at a time.

S
A

Implements 2:1 Mux function

If S=0 then Y = A
If S=1 then Y = B

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

23
47
Combinational Building Blocks: Mux

Copyright 2005. Thomson/Delmar Learning, All rights reserved.


ECE 234

48
Binary Adder
F (A,B,C) = A xor B xor C G = AB + AC + BC

These equations look familiar. These define a Binary Full


Adder :

A B
Sum = A xor B xor Cin
Cout = AB + Cin A + Cin B
A B = AB + Cin (A + B)
Cout Cin
Co Ci
S

Sum
Full Adder (FA)

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

24
49
4 Bit Ripple Carry Adder
A(3) B(3) A(2) B(2) A(1) B(1) A(0) B(0)

Cout C(4) A B C(3) A B C(2) A B C(1) A B C(0)


Co Ci Co Ci Co Ci Co Ci Cin

S S S S

Sum(3) Sum(2) Sum(1) Sum(0)

A[3:0]
SUM[3:0]

B[3:0] +
Source: R. Reese, J.W. Bruce and B. Jones ECE 234

50
Incrementer
A(3) A(2) A(1) A(0)

EN

xor xor xor xor

Y(3) Y(2) Y(1) Y(0)

If EN = 1 then Y = A + 1
If EN = 0 then Y = A A[3:0]
inc Y[3:0]
EN

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

25
51
Combinational Right Shifter
A combinational block that can either shift right or pass data
unchanged

Copyright 2005. Thomson/Delmar Learning, All rights reserved.


ECE 234

52
Understanding the shift operation

MSB LSB

0x85 = 1 0 0 0 0 1 0 1
SI = 0

0x42 = 0 1 0 0 0 0 1 0 1st right shift

SI = 0

0x21 = 0 0 1 0 0 0 0 1 2nd right shift

SI = 0

0x10 = 0 0 0 1 0 0 0 0 3rd right shift

Etc….

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

26
53
Right Shift vs Left Shift
A right shift is MSB to LSB

In: D7 D6 D5 D4 D3 D2 D1 D0

SIN

Out: SIN D7 D6 D5 D4 D3 D2 D1

A left shift is LSB to MSB

In: D7 D6 D5 D4 D3 D2 D1 D0

SI

Out: D6 D5 D4 D3 D2 D1 D0 SI

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

54
Basic Memory Definition

KxN

Address[log2(K)-1:0] Data[N-1:0]
M
E
M

K locations, N bits per location


Address bus has log2(K) address lines, data bus has N data
lines.

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

27
55
Memory: Implement Logic or Store Data
F (A,B,C) = A xor B xor C G = AB + AC + BC
8 x 2 Memory
ABC F G
00 0 0 0 A A2 F
00 1 1 0 D1
B A1 G
01 0 1 0 DO
01 1 0 1 C
A0
10 0 1 0
10 1 0 1 LookUp Table (LUT)
11 0 0 1
11 1 1 1
A[2:0] is 3 bit address
bus, D[1:0] is 2 bit
Recall that Exclusive OR (xor) is output bus.
Location 0 has “00”,
A B Y
0 0 0
Location 1 has “10”,
Y = AB Location 2 has “10”,
0 1 1
= A xor B etc….
1 0 1
1 1 0

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

56
Clock Signal Review

Pw
rising edge falling edge
voltage
 - period (in seconds) Pw - pulse width (in seconds)

time f - frequency pulse width (in Hertz) f = 1/

duty cycle = Pw /
duty cycle - ratio of pulse width to period (in %)

millisecond (ms) Kilohertz (KHz)


-3 3
10 10
microsecond (s) Megahertz (MHz)
-6 6
10 10
nanosecond (ns) Gigahertz (GHz)
-9 9
10 10

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

28
57
Storage Element: The D Flip-Flop

D: data input
CK: clock input
S : set input (asynchronous, low true)
R: reset input (asynchronous, low true)

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

58
Registers
The most common sequential building block is the register.
A register is N bits wide and has a load line for loading in a
new value into the register.

Note that DFF simply loads old value when LD = 0.


DFF is loaded every clock cycle.

Copyright 2005. Thomson/Delmar Learning, All rights reserved.


ECE 234

29
59
Counter
Very useful sequential building block. Used to generate
memory addresses, or keep track of the number of times a
datapath operation is performed.

Copyright 2005. Thomson/Delmar Learning, All rights reserved.


ECE 234

60
Shift Register
Very useful sequential building block. Used to perform either
parallel to serial data conversion or serial to parallel data
conversion.

Copyright 2005. Thomson/Delmar Learning, All rights reserved.


ECE 234

30
61
What do you need to Know?
 Convert hex, binary integers to Decimal
 Convert decimal integers to hex, binary
 Convert hex to binary, binary to Hex
 N binary digits can represent 2N values, unsigned
integers 0 to 2N-1.
 Addition, subtraction of binary, hex numbers
 Detecting unsigned overflow

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

62
What do you need to know? (cont)
 ASCII, UNICODE are binary codes for character
data
 Basic two-input Logic Gate operation
 NMOS/PMOS Transistor Operations
 Inverter/NAND transistor configurations
 Tri-state buffer operation
 Mux, Memory, Adder operation
 Clock signal definition
 DFF, Register, Counter, Shifter register operation

Source: R. Reese, J.W. Bruce and B. Jones ECE 234

31

You might also like