數字邏輯課件2 2補碼chenyu_第1頁
數字邏輯課件2 2補碼chenyu_第2頁
數字邏輯課件2 2補碼chenyu_第3頁
數字邏輯課件2 2補碼chenyu_第4頁
數字邏輯課件2 2補碼chenyu_第5頁
已閱讀5頁,還剩27頁未讀 繼續免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

class-exercises161、1011100010112=

8=2、

(

156

)10

=

(

)23、convert

0.3910

to

anumber

in

radix2.Theprecision

must

achieve10%。ten

minutesclass-exercises161、1011100010112=

5613

8=

B8B2、

(

156

)10

=

(

10011100

)23、將0.3910轉換為二進制數,要求精度達到10%。0.01102Review

of

the

last

lessonPositional

Number

SystemsMSD,LSD,MSB,LSBGeneral

Positional-Number-System

ConversionsA

decimal

fraction

A

number

in

Binary

radixBinary

addition

and

subtraction2.5

Representation

of

NegativeNumbers(負數的表示)Signed-Magnitude

Representation

P34[符號–數值表示法(原碼)]Complement

Number

Systems

P35(補碼數制)Radix-Complement

Representation

P36(基數補碼表示法)Two’s-Complement

Representation

P37(二進制補碼表示法)2.6

Two’s-Complement

Addition

and

Subtraction

P39(二進制補碼的加減法)Table

2-6

P40(十進制數與4位二進制數對照表)2.6.3

Overflow

(溢出)

P412.5.1

Signed-Magnitude

Representationa

number

consists

of

a

magnitude

and

a

symbol indicating

whether

the

magnitudeis

positive

or negative.MSB

as

the

Sign

bit

(0

=

plus,

1

=

minus)[最高有效位表示符號位(

0=正,1=負)]01111111=+12700101110=+4600000000=+011111111=-12710101110=-4610000000=-02.5.1

Signed-MagnitudeRepresentation [符號–數值表示法(原碼)] Two

possible

representations

of

Zero[零有兩種表示(+0、–0)]An

n-bit

signed-magnitude

integer

range

is (n位二進制整數表示范圍):–

(

2n-1

1)

~

+

(

2n-1

1)– The

signed-magnitude

system

has

an

equalnumber

of

positive

and

negative

integers.P35represent

the

result

with8-bitsigned-magnitude

integer!110-110=?the

signed-magnitude

system

negatesa

number

by

changing

its

sign

.Complement

Number

Systemsitnegates

a

number

bytaking

its

complement

as

definedby the

system.2.5.2 Complement

Number

Systems(補碼數制)radix

Complement(基數補碼)Diminished

Radix

Complement [基數減1補碼(反碼)]2.5.22.5.2Complement

Number

Systems(補碼數制)an

n-bit

numberDD

=

dn–1dn–2·

· ·d1d0

.The

radix

point

is

on

the

right

and

sothe

number

is

an

integer.

If

anoperation

produces

a

result

that

requiresmore

than

n

digits,

we

throw

away

theextra

highorder

digit(s).

If

a

number

Dis

complemented

twice,

the

result

isD.

(P35)2.5.3

Radix-Complement

RepresentationThe

complement

of

an

n-digit

numberis

obtained

by

subtracting

it

from

r

n

.r’s

complement= r

n

-D(n位數D的基數補碼等于從

r

n

中減去該數)Example

:

Table

2-4

P362.5.3

Radix-ComplementRepresentation2.5.3

Radix-Complement

Representationr’s

complement= r

n

-DIf

D

is

between

1

and

rn

1,

thissubtraction

produces another

numberbetween

1

and

r

n

-

1.what

is

the

result

of

the

subtraction,IfD

is

0?2.5.3

Radix-Complement

Representationr’s

complement= r

n

-DIf

D

isbetween1

and

rn

1,

thissubtraction

produces

anothernumberbetween1and

r

n

-1.what

is

the

result

ofthesubtraction,

IfD

is

0?

0000000…0

(n-bit)(positive)Diminished

Radix–

ComplementRepresentation[基數減1補碼表示法(反碼)]The

Diminished

Radix

Complement

ofan

n-digit

number

is

obtained

bysubtracting

it

from

r

n

-1[

n位數的反碼等于從

rn

1

中減去該數]Example:

Table

2-4

,2-5

P.36(r-1)’s

Complement

=

r

n

1-D*2.5.6

(P38)there

are

two

representations

of

zero,positive

zero

(00

×

×

×

00)

andnegative

zero

(11

×

×

×

11).2.5.3

Radix-ComplementRepresentation2.5.3

Radix-ComplementRepresentationAdvantager

n

–D=

[(r

n-1)-D]+1This

can

becomplementingplished

bythe

individual

digits

of

D,2.5.4

Two’s

Complement

Representation(二進制補碼表示法)Two’s-Complement(二進制補碼的求取):MSB

(the

signbit): 1=minus;

0=plusWeight

of

the

MSB:-2n-13.

The

range

of

representablenumbers

is-(2

n-1)

through

+(2

n-1

-1).Two’s-Complement(二進制補碼的求取)Example

1. Write

the

8-bit

two’

plementrepresentation

for

the

decimal

number:

-119.(若約定字長是一個字節,試求-119的補碼表示。)?=011101112,as

formula(公式):2n-D=

(2n-1-D)+128-1:

1

1

1

1

1

1

1

1subtract(減去)+119; -0

1

1

1

0

1

1

11

0

0

01

0

0

0+

1?plus(加)1:-11910:1

0

0

0

1

0

0

12Two’s-Complement(二進制補碼的求取)Example

1. Write

the

8-bit

two’

plementrepresentation

for

the

decimal

number:

-119.(若約定字長是一個字節,試求-119的補碼表示。)=011101112,?Two’s-Complement(二進制補碼的求取)100010002

+

1

100010012=-11910Example

1. Write

the

8-bit

two’

plementrepresentation

for

the

decimal

number:

-119.(若約定字長是一個字節,試求-119的補碼表示。)=011101112,帶符號位一起按位取反再+1,得到相反數的補碼.表2-61位十進制數與4位二進制數(P40)十進制二進制原碼二進制反碼二進制補碼-8————1000-7111110001001-6111010011010-5110110101011-4110010111100-3101111001101-2101011011110-110011110111101000或00001111或000000001000100010001200100010001030011001100114010001000100501010101010160110011001107011101110111Sumupfor theComplement(總結)1. Positive

number

has

the

same:Sign-Magnitude,Ones’

Complement,and

Two’s-

Complement(正數的原碼、反碼、補碼相同)Sumupfor theComplement(總結)Complement

Number

Systemssigned-magnitude

system010001101111(010001)-1710(110001)Complement(總結)(010001)不變-1710(101111)(010001)符號位改-1710變(110001)符號位不變其余按位取反加1.Complement

Number

Systems連同符號位一起按位取反加1.signed-magnitude

system符號位改變Sign

extension(符號位擴展)We

can

convert

an

n-bit

two’

plementnumber

X

into

an

m-bit

one,

but

some

careis

needed.If

m

>

n,

we

must

append

m

-

n

copies

of X’s

sign

bit

to

the

left

of

X

.

That

is,

we pad

a

positive

number

with

0s

and

a negative

one

with

1s;

this

is

called

signextension.If

m

<

n,

we

discard

X’s

n

m

leftmost

bits;however,

the

result

is

valid

only

if

allof

the

discarded

bits

are

the

same

asthe sign

bit

of

the

result

.2.6

Two’s

–Complement

Additionand

Subtraction

(二進制補碼的加法和減法)we

define

[x]to

be

the

two’

plementrepresentation

of

x[x+y]=

([x]+[y]

)[x-

y]=

(

[x]+

[-y]

)2.6

Two’s

–Complement

Additionand

Subtrac

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論