tailieunhanh - Lecture Introduction to computing systems (from bits & gates to C & beyond): Chapter 2 - Yale N. Patt, Sanjay J. Patel

Chapter 2 -Bits, data types and operations. In this chapter, we will address the following questions: How do we represent data in a computer? Computer is a binary digital system, what kinds of data do we need to represent? Unsigned integers, unsigned binary arithmetic,. | Chapter 2 Bits, Data Types & Operations Integer Representation Floating-point Representation Logic Operations Data types Our first requirement is to be able to represent information (data) in a form that is mutually comprehensible by human and machine. Ultimately, we will have to develop schemes for representing all conceivable types of information - language, images, actions, etc. We will start by examining different ways of representing integers, and look for a form that suits the computer. Specifically, the devices that make up a computer are switches that can be on or off, . at high or low voltage. Thus they naturally provide us with two symbols to work with: we can call them on & off, or (more usefully) 0 and 1. 2 - Decimal Numbers “decimal” means that we have ten digits to use in our representation (the symbols 0 through 9) What is 3,546? it is three thousands plus five hundreds plus four tens plus six ones. How about negative numbers? we use two more symbols to distinguish positive and negative: + and - 2 - Unsigned Binary Integers 3-bits 5-bits 8-bits 0 000 00000 00000000 1 001 00001 00000001 2 010 00010 00000010 3 011 00011 00000011 4 100 00100 00000100 Y = “abc” = + + N = number of bits Range is: 0 i 2 - Signed Magnitude Leading bit is the sign bit -4 10100 -3 10011 -2 10010 -1 10001 -0 10000 +0 00000 +1 00001 +2 00010 +3 00011 +4 00100 Range is: -2N-1 + 1 2 - One’s Complement Invert all bits -4 11011 -3 11100 -2 11101 -1 11110 -0 11111 +0 00000 +1 00001 +2 00010 +3 00011 +4 00100 Range is: -2N-1 + 1 2 - Two’s Complement . | Chapter 2 Bits, Data Types & Operations Integer Representation Floating-point Representation Logic Operations Data types Our first requirement is to be able to represent information (data) in a form that is mutually comprehensible by human and machine. Ultimately, we will have to develop schemes for representing all conceivable types of information - language, images, actions, etc. We will start by examining different ways of representing integers, and look for a form that suits the computer. Specifically, the devices that make up a computer are switches that can be on or off, . at high or low voltage. Thus they naturally provide us with two symbols to work with: we can call them on & off, or (more usefully) 0 and 1. 2 - Decimal Numbers “decimal” means that we have ten digits to use in our representation (the symbols 0 through 9) What is 3,546? it is three thousands plus five hundreds plus four tens plus six ones. How about negative numbers? we use two more symbols to .

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.