计算机组织与架构期末复习总结--ASCll、奇偶校验

目录

ASCII

ASCII Table

Characters string

Parity(奇偶校验)

Even Parity

Odd Parity

Parity Block(奇偶校验快)

Task1

Task2


ASCII

 The most common encoding (最常见的编码)is ASCII.

 ASCII uses 7 bits to encode most characters in widespread use long, long ago. (It dates from the 1960s).

 Question: If it uses 7 bits, how many distinct characters can be represented?

 (Aside: There is a thing called ASCIIbetical order.)


ASCII Table


                                                3-0位                  ASCII Table               6-4位                

000

001

010

011

100

101

110

111

0000

NUL

DEL

SP

0

@

P

`

p

0001

SOH

DC1

!

1

A

Q

a

q

0010

STX

DC2

"

2

B

R

b

r

0011

ETX

DC3

#

3

C

S

c

s

0100

EOT

DC4

$

4

D

T

d

t

0101

ENQ

NAK

%

5

E

U

e

u

0110

ACK

SYN

&

6

F

V

f

v

0111

BEL

ETB

'

7

G

W

g

w

1000

BS

CAN

(

8

H

X

h

x

1001

HT

EM

)

9

I

Y

i

y

1010

LF

SUB

*

:

J

Z

j

z

1011

VT

ESC

+

;

K

[

k

{

1100

FF

FS

,

<

L

\

1

1101

CR

GS

-

=

M

]

m

}

1110

SO

RS

>

N

^

n

~

1111

SI

US

/

?

O

_

o

DEL


Characters string

Other encodings

Unicode includes many, many characters and has begun to replace ASCII in many applications. (ASCII is incorporated into Unicode).(ASCII被并入Unicode)

Extended ASCII uses 8 bits to include additional characters.(扩展的ASCII使用8位来包含附加的字符)

       


Parity(奇偶校验)

 A useful feature of 7-bit ASCII is that it allows primitive error checking on transmissions(对传输进行原始错误检查).

 Parity refers to a sender and receiver agreeing that any character transmitted will always  contain an odd or even number of 1s.

 If the receiver sees a pattern that breaks this rule, it can reject the data, or request  retransmission.

Even Parity

Example using even parity.

 'A' is ASCII 6510  .

 Convert 6510 to 10000012  (note 7 bits).

 Bit pattern to send is 01000001 to maintain even parity.(实现偶数奇偶校验)

 Receiver sees an even number of 1s(接收器看到的偶数为1), so knows all   is well. (If the receiver sees, say, 01000000 it knows something has gone wrong, but cannot determine  what.)

Odd Parity

 Example using odd parity.

 'A' is ASCII 6510  .

 Convert 6510 to 10000012  (note 7 bits).

 Bit pattern to send is 11000001 to achieve odd parity.(实现奇数奇偶校验)

 Receiver sees an odd number of 1s(接收器看到的奇数为1), so knows all is well.(If the receiver sees, say, 11001001 it knows   something has gone wrong, but cannot determine what.)

Parity Block(奇偶校验快)

Send "ab" together in a parity block using even parity.

 'a' is 1100001.

 'b' is 1100010.


Task1

 What bytes will be transmitted when sending “CFS in  standardASCII encoding using odd parity (奇数校验)over the network?

 ANS: The following bytes will be transmitted:

        01000011, 01000110, 11010011.

C

0

1

0

0

0

0

1

1

S

0

1

0

0

0

1

1

0

F

1

1

0

1

0

0

1

1

what is the parity byte if we transmit    CFS”?

in a parity block using the same parity scheme?  ANS: The parity byte is 00101001.

0

1

0

0

0

0

1

1

0

1

0

0

0

1

1

0

1

1

0

1

0

0

1

1

0

0

1

0

1

0

0

1


Task2

Suppose that an even parity scheme is used. The  receiver sees the below parity block that sends two characters over. What are the two most likely  characters being sent?

1

1

1

0

1

0

0

0

0

1

1

0

0

0

0

1

1

0

0

0

0

0

0

1

ANS: The two most likely characters sent over should be hi”.

According to the given parity block, we can see that there is something wrong with the

second byte,  which contains only an odd number of 1s

1

1

1

0

1

0

0

0

0

1

1

0

0

0

0

1

1

0

0

0

0

0

0

1

We can also see that there is something wrong with the fifth column from the left-hand side,

which contains only an odd number of 1s

1

1

1

0

1

0

0

0

0

1

1

0

0

0

0

1

1

0

0

0

0

0

0

1

Then we can infer that it is mostly likely that the bit in the cell at row 2 and column 5 has been altered  during transmission.

1

1

1

0

1

0

0

0

0

1

1

0

0

0

0

1

1

0

0

0

0

0

0

1

Therefore, the original parity block should be the following with a very high probability:

1

1

1

0

1

0

0

0

0

1

1

0

1

0

0

1

1

0

0

0

0

0

0

1

 Then we can infer that the two most likely characters  sent over should be ‘h’ (01101000) and ‘i’ (01101001).

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

什么时候养猫猫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值