Docsity

Laboratory Assignment 3: pMIPS Combinational Logic Blocks II | ECE 371, Lab Reports of Microprocessors

Partial preview of the text

Download Laboratory Assignment 3: pMIPS Combinational Logic Blocks II | ECE 371 and more Lab Reports Microprocessors in PDF only on Docsity!

LABORATORY ASSIGNMENT # 3

pMIPS

Combinational Logic Blocks II

pMIPS

Combinational Logic Blocks II

Extender, Comparator, Hex-To-7-Segment Decoder/Driver, 8-bit ASU

SPRING 2009

ECE 371: Microprocessor Systems

Department of Electrical and Computer EngineeringSchool of Engineering, Mathematics, and Science

Purdue University – Calumet

Binary Number Extension

•^

How does one increase the number of bits of a binarynumber while preserving its sign (positive/negative)?–

Sign Extension

-^

To sign-extend an

m

-bit 2’s comp. number to

n-

bits (m < n), append

the sign bit to the MSB end until the

m

-bit number contains

n

bits.

10

(8-bits) = 0xEF

16

= 1110 0000

2

•^

What about unsigned numbers?–

Zero Extension

-^

To zero-extend an

m

-bit unsigned number to

n-

bits (m < n), append

zeros to the MSB end until the number contains

n

bits.

10

(16-bits) = 0x

FF

EF

16

= 1111 1111

^1

110 0000

2

32

10

(8-bits) = 0x

16

= 0010 0000

2

32

10

(16-bits) = 0x

00

20

16

= 0000 0000

0010 0000

2

8-bit Carry-Look-ahead Adder (CLA)

Using Ripple Carry Organization

4 τ

6 τ

Assumptions •^

1 τ

gate delay for AND/OR Gates

-^

2 τ

gate delay for XOR Gates

-^

p(Ai

,Bi

) = Ai

XOR Bi

8 τ i

6 τ

2’s Complement Subtraction: Hardware

  • What about subtraction?
    • Like addition, just take 2’s comp. of B and add!
      • Just invert all bits of B and then add ‘1’• Not good approach…need 2 8-bit CLA’s, one for

add, and another for sub.

A – B = A +

(-B)

  • Use 1, 8-bit CLA w/ “control” circuit for add/sub
    • XOR Gate is the “control” circuit• Use one of the inputs as an add/sub control

Available VHDL Packages

-^

Very Useful Packages^ •

std_logic_

-^

Defines

STD_LOGIC

and

STD_LOGIC_VECTOR

types

numeric_std

std_logic_arith

Focus Here!

Link

:^

http://www.csee.umbc.edu/help/VHDL/stdpkg.html

std_logic_unsigned

std_logic_signed

-^

Less Useful (for ECE 371/ECE 464) Packages^ •

numeric_bit

math_real

math_complex

Focus Here!

VHDL

NUMERIC_STD

Package

•^

Defines numeric types and arithmetic functions^ •

UNSIGNED

: represents unsigned

number in vector form

based on base element type

STD_LOGIC
SIGNED

: represents a signed

number in vector form

based on base element type

STD_LOGIC
•^

The leftmost bit is treated as the most significant bit.

-^

The leftmost bit is treated as the most significant bit.

-^

Signed vectors are represented in two's complement form.

-^

Operators

•^

Functions

:^

ABS(), REM(), MOD(), SHIFT_LEFT(), SHIFT_RIGHT(),

ROTATE_LEFT(), ROTATE_RIGHT(), RESIZE(), TO_INTEGER(),TO_UNSIGNED(), TO_SIGNED(), TO_STDLOGICVECTOR(), NOT(),AND(), OR(), AND(), NOR(), NAND(), XOR(), XNOR(), STD_MATCH()

Link

:^

http://www.csee.umbc.edu/help/VHDL/stdpkg.html

STD_LOGIC_(UN)SIGNED

Package

STD_LOGIC_UNSIGNED

Package

•^

Provides unsigned

numerical computation capabilities on

type

STD_LOGIC_VECTOR
STD_LOGIC_VECTOR

types as unsigned numbers

•^

Operators

•^

Functions

: SHL(), SHR()
•^

Functions

: SHL(), SHR()

STD_LOGIC_SIGNED

Package

•^

Provides signed

numerical computation capabilities on

type

STD_LOGIC_VECTOR
STD_LOGIC_VECTOR

types as signed numbers

•^

Operators

•^

Functions

: SHL(), SHR(), ABS(), CONV_INTEGER()

Link

:^

http://www.csee.umbc.edu/help/VHDL/stdpkg.html

VHDL

OPEN

Keyword

•^

The

OPEN

keyword is used to map an unused output (does

not work for input, why?) port of an instantiated module

-^

Input ports cannot be left “open”.^ •

If an input port does not require mapping, connect it to GND or VCCvia VHDL

CONSTANTS

or literals.

•^

Example

:^ Output ports

G

and

P

of both CLAs not used. Use

OPEN

to

connect the ports.connect the ports.

LSB_CLA_4bit : CLA_4bit PORT MAP

(, ,

, GroupGen =>

OPEN

, GroupProp =>

OPEN

);