COMP190 Digital Logic and Computer Design - PowerPoint PPT Presentation

1 / 54
About This Presentation
Title:

COMP190 Digital Logic and Computer Design

Description:

Download to chip. 5. The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL. We Will Use This Board ... Full version in lab. Can use free version on your PC, but slower. 9 ... – PowerPoint PPT presentation

Number of Views:1563
Avg rating:3.0/5.0
Slides: 55
Provided by: anselmo9
Category:

less

Transcript and Presenter's Notes

Title: COMP190 Digital Logic and Computer Design


1
COMP190 Digital Logic and Computer Design
  • Anselmo Lastra

2
Todays Topics
  • Course description
  • Whats it about
  • Mechanics grading, etc.
  • Material from Chapter 1
  • What is digital logic?
  • Binary signaling
  • Number systems
  • Codes

3
Whats Course About?
  • Course will be COMP160
  • Digital logic focusing on the design of computers
  • Stay above transistor level
  • Only one class on this
  • Each person design a MIPS CPU
  • And peripheral logic (VGA, keyboard)
  • Mostly use high-level language
  • Stay above gate level

4
How Can We Do This?
  • Field Programmable Gate Arrays
  • Chips with a lot of circuits
  • Tens of thousands to millions of transistors
  • Programmable, either once or many times
  • We write programs describing design
  • Download to chip

5
We Will Use This Board
6
Schematic Diagram
7
Verilog
  • /
  • A 32-bit counter with only 4 bits of output.
    The idea is
  • to select which of the counter stages you
    want to pass on.
  • Anselmo Lastra, November 2002
  • /
  • module cntr_32c(clk,res,out)
  • input clk
  • input res
  • output 30 out
  • reg 310 count
  • always _at_ (posedge res or posedge clk)
  • if(res)
  • count
  • else
  • count

8
Xylinx Software
  • Use design tools from chip maker
  • Have full version on lab PCs
  • Webpack (version 6.1i) for your PC
  • I can hand out CDs
  • ModelSim simulator
  • Full version in lab
  • Can use free version on your PC, but slower

9
Class Web Pages
  • http//www.cs.unc.edu/lastra/comp190
  • Lets browse
  • Linked from my home page in case you forget
  • All notes posted
  • Will try to make put them there before class
  • Blackboard for grades
  • Class forum (linked to class page)
  • Labs there also

10
Textbook
  • Morris Mano and Charles Kime
  • Logic and Logic and Computer Design Fundamentals,
    3rd Edition
  • Prentice Hall, 2004
  • Will largely to follow text

11
Overview of Textbook
  • Chapters 1-6 Digital logic
  • Combinational and sequential
  • Chapter 7-8 Register Transfer and State Machines
  • Chapter 9 Memories
  • Chapters 10-12 Computer design
  • Chapter 13 I/O
  • Chapter 14 Memory Hierarchies

12
Will Also Need
  • COMP120 book
  • For MIPS reference
  • Verilog reference
  • Book optional
  • Web see course home page

13
Grading
  • Labs 35
  • Easier at first latter ones will count more
  • Homework 20
  • Two tests spaced evenly 12.5 each
  • Final 20

14
Labs
  • Paced slowly at first
  • Familiarization with tools
  • Build up computer components
  • Registers, ALU, decoder
  • Peripheral VGA, keyboard interface
  • Assemble a simple MIPS
  • Add more features
  • Final demo game or similar

15
Lab Sections
  • Everyone signed up for 100 lab
  • At limit of XSA cards
  • Over number of computers
  • Who will use laptop?
  • No lab this Friday
  • Begins next week

16
Late Policy
  • Homework assignments and lab reports due by class
    time (200 PM)
  • One class late, 10 points off
  • Two classes late, 25 points off
  • Not accepted later

17
Whats Your Background?
  • Course experience
  • Work, etc.
  • Which COMP120?
  • Whats your intent in taking class?
  • Questions?

18
Office Hours
  • Would like to wait a week to set
  • Or not have set hours
  • Send email if you want to meet

19
Now Shift to Technology
  • Should be review

20
Digital vs. Analog
  • Analog infinite resolution
  • Like (old fashioned) radio dial
  • Digital a finite set of values
  • Like money
  • Cant get smaller than cents
  • Typically also has maximum value

21
Binary Signaling
  • Zero volts
  • FALSE or 0
  • 3.3 or 5 volts
  • TRUE or 1
  • Why not multilevel signaling?

22
Discrete Data
  • Some data inherently discrete
  • Names (sets of letters)
  • Some quantized
  • Music recorded from microphone
  • Note that other examples like music from CD or
    electronic keyboard already quantized
  • Mouse movement is quantized
  • Well, some mouse movement

23
Numbers and Arithmetic
  • Review of binary numbers,
  • Hexadecimal,
  • Arithmetic,
  • Other codes

24
Binary Numbers
  • Strings of binary digits (bits)
  • One bit can store a number from 0 to 1
  • n bits can store numbers from 0 to 2n

25
Binary Powers of 2
  • Positional representation
  • Each digit represents a power of 2
  • So 101 binary is
  • 1 22 0 21 1 20
  • or
  • 1 4 0 2 1 1 5

26
Converting Binary to Decimal
  • Easy, just multiply digit by power of 2
  • Just like a decimal number is represented
  • Example follows

27
Binary ? Decimal Example
What is 10011100 in decimal?
128 0 0 16 8 4 0 0
156
28
Decimal to Binary
  • A little more work than binary to decimal
  • Some examples
  • 3 2 1 11 (thats 121 120)
  • 5 4 1 101 (thats 122 021 120)

29
Algorithm Decimal to Binary
  • Find largest power-of-two smaller than decimal
    number
  • Make the appropriate binary digit a 1
  • Subtract the power of 2 from decimal
  • Do the same thing again

30
Decimal ? Binary Example
  • Convert 28 decimal to binary

32 is too large, so use 16
Binary ? 10000
Decimal ? 28 16 12
Next is 8
Binary ? 11000
Decimal ? 12 8 4
Next is 4
Binary ? 11100
Decimal ? 4 4 0
31
Hexadecimal
  • Strings of 0s and 1s too hard to write
  • Use base-16 or hexadecimal 4 bits

32
Hexadecimal
  • Letters to represent 10-15
  • Power of 2
  • Size of byte

33
Hex to Binary
  • Convention write 0x before number
  • Hex to Binary just convert digits

0x2ac
0x2ac 001010101100
No magic remember hex digit 4 bits
34
Binary to Hex
  • Just convert groups of 4 bits

101001101111011
1011
0101 ?
0111 ?
0011 ?
101001101111011 0x537b
35
Hex to Decimal
  • Just multiply each hex digit by decimal value,
    and add the results.

0x2ac
2 256
10 16
12 1
684
36
Decimal to Hex
  • Analogous to decimal ? binary.
  • Find largest power-of-16 smaller than decimal
    number
  • Divide by power-of-16. The integer result is hex
    digit.
  • The remainder is new decimal number.
  • Do the same thing again

37
Decimal to Hex
684
0x2__
684/256 2
684256 172
0x2a_
172/16 10 a
0x2ac
17216 12 c
38
Octal
  • Octal is base 8
  • Similar to hexadecimal
  • Conversions
  • Less convenient for use with 8-bit bytes

39
BCD
  • Binary Coded Decimal
  • Decimal digits stored in binary
  • Four bits/digit
  • Like hex, except stops at 9
  • Example
  • 931 is coded as 1001 0011 0001
  • Remember these are just encodings. Meanings are
    assigned by us.

40
Other Codes Exist
  • Non positional
  • Example Gray Code
  • Only one bit changes at a time
  • 000,001,011,010,110,111,101,100
  • Why is this useful?

Ref http//lib-www.lanl.gov/numerical/bookcpdf/c2
0-2.pdf
41
Shaft Encoder
42
Arithmetic -- addition
  • Binary similar to decimal arithmetic

No carries
Carries
11 is 2 (or 102), which results in a carry
43
Arithmetic -- subtraction
No borrows
Borrows
0 - 1 results in a borrow
44
Arithmetic -- multiplication
Successive additions of multiplicand or
zero, multiplied by 2 (102). Note that
multiplication by 102 just shifts bits left.
45
Hexadecimal Arithmetic
  • Similar
  • If youre doing by hand, easiest to convert each
    set of digits to decimal and back
  • Skill is not very useful

46
Character Codes
  • From numbers to letters
  • ASCII
  • Stands for American Standard Code for Information
    Interchange
  • Only 7 bits defined

47
ASCII table
48
Even Parity
  • Sometimes high-order bit of ASCII coded to enable
    detection of errors
  • Even parity set bit to make number of 1s even
  • Examples
  • A (01000001) with even parity is 01000001
  • C (01000011) with even parity is 11000011

49
Odd Parity
  • Similar except make the number of 1s odd
  • Examples
  • A (01000001) with odd parity is 11000001
  • C (01000011) with odd parity is 01000011

50
Error Detection
  • Note that parity detects only simple errors
  • One, three, etc. bits
  • More complex methods exist
  • Some that enable recovery of original info
  • Cost is more redundant bits

51
Todays Topics
  • Introduction
  • Digital logic
  • Number systems
  • Arithmetic
  • Codes
  • Parity
  • The encoding is key
  • Standards are used to agree on encodings
  • Special purpose codes for particular uses

52
Homework
  • None, but
  • I expect you to be able to know binary number
    system and to do conversions
  • Decimal Binary
  • Binary Decimal
  • Decimal Hex
  • Hex Decimal
  • Can do some of the problems 1-2, 1-4, 1-7.
    Answers on book website.

53
Reading
  • Skim chapter 1
  • Quick read to make sure youre comfortable with
    material
  • Read Chapter 2

54
Next Week
  • Combinational Logic Basics
  • Lab preview
  • Ill demo tools in class, probably Thursday
  • Lab on Friday
Write a Comment
User Comments (0)
About PowerShow.com