Complete and in depth lecture notes for Weeks 1 to 5 of Level 1 Computer Architecture as taught by Queen's University Belfast. This is all that is required for Assessment 1, which is 50% of the module. Includes images and Diagrams as well as all information from in lecture slides compiled into one ...
Intro to Computer Architecture
Weeks 1 to 5 Lecture Notes for Lecturer Moira Watson at QUB
Week 1
Number Systems
Binary - Base 2 system
Known as base 2 because it only uses two digits. 0 and 1. A single bit is a 1 or a 0, a Binary Digit. Data is converted using the
power of two.
base 2⁸ 2⁷ 2⁶ 2⁵ 2⁴ 2³ 2²
value 128 64 32 16 8 4 2
An example of binary: 0d156 = 0b10011100
To convert denary to binary, repeatedly divide the denary value by two and the remainders are the binary value, read from
bottom (0) to top (the denary value). To go back to denary, multiply by two.
A byte is 8 bits while a nibble is 4 bits.
Hexadecimal - Base 16 system
Hexadecimal is a base 16 number system, so it is used as a shorthand notation for long bit patterns. In order to have 16
characters, it uses 0 to 9, and A - F. The prefix is 0x. Binary to Hex looks like this.
Decimal Binary Hex value
0d0 0b0000 0x0
0d1 0b0001 0x1
0d2 0b0010 0x2
0d3 0b0011 0x3
0d4 0b0100 0x4
0d5 0b0101 0x5
0d6 0b0110 0x6
0d7 0b0111 0x7
0d8 0b1000 0x8
0d9 0b1001 0x9
0d10 0b1010 0xA
0d11 0b1011 0xB
0d12 0b1100 0xC
0d13 0b1101 0xD
0d14 0b1110 0xE
0d15 0b1111 0xF
For example, the value 0d109 has the binary equivalent 0b01101101 and therefore the hex value 0x6D.
32 bit memory words are often initialised to the hex 0xDEADBEEF because it is easy to spot and highly unlikely to occur
naturally. Two hex digits are equivalent to a byte.
Octal - Base 8 system (not examinable)
In the 60’s 12, 24 and 36 bit systems were common so octal was developed to correspond to 3 binary digits since 12, 24 and
36 were divisible by 3. The octal prefix is 0o.
The only current use is in Linux file permissions, and air traffic control. Converting to octal is done in the same manner as
binary, by dividing by 8 and noting the remainder.
Week 2
Intro to Computer Architecture 1
, Binary Arithmetic and Two’s Complement
Binary Addition
There are four rules that need to be followed when adding binary numbers.
0+0=0
1+0=1
1 + 1 = 0 carry 1 (10)
1 + 1 + 1 = 1 carry 1 (11)
Binary Subtraction
In order to subtract, we add a negative value eg. 7 + (-)3
To do this we need negative numbers, and to represent negative numbers there are a variety of options:
Sign Magnitude -
0001 = +1 and 1001 = -1
One’s Complement -
0001 = +1 and 1110 = -1
Two’s Complement -
0001 = +1 and 1111 = -1
In computing we use Two’s Complement. Why?
Addition and subtraction is simplified.
Circuitry is the same for signed and unsigned.
No separate sign bit.
There is symmetry with the number of positive and number of negative numbers represented.
it is simple.
Most computers are designed to work with two’s complement so it provides compatibility and interoperability.
Two’s Complement Notation
The leftmost bit or the most significant bit indicates the sign of the value represented and is called the ‘sign bit’.
NEGATIVE - 1
POSITIVE - 0
To convert from negative to positive or positive to negative, flip the bits and add one:
Bit Pattern Value in Denary
0111 7
0110 6
0101 5
0100 4
0011 3
0010 2
0001 1
0000 0
1111 -1
1110 -2
1101 -3
1100 -4
1011 -5
1010 -6
1001 -7
1000 -8
Intro to Computer Architecture 2
, Two’s Complement Range
When using 4 bits, we have a range of positive values 0 to 7, and negative values -1 to -8.
For N bits, we have a range of positive values 0 to 2N −1 − 1, and negative values -1 to 2N −1 .
Algorithm for Decoding Two’s Complement
If the pattern has a sign bit of 0, read the value as though the pattern were normal binary representation.
If the pattern has a sign bit of 1, the value is negative, and therefore flip the bits and add 1 to decode.
Back to Subtraction
Computers can only add, so to perform subtraction we add a negative.
Apply the same theory for binary addition but truncate any extra bit generated from the left.
Overflow
There is a limit to the size of values that can be represented in any system and this phenomenon is called overflow, when a
computation produces a value that falls outside of the range of values that can be represented.
We know this has occurred in two’s complement when the sign changes unexpectedly.
This error is the reason that 16 bit systems were upgraded to 32 bit systems for storing values in two’s complement notation.
If larger values are still needed longer bit patterns can be used or the units of measure can be changed.
Capacity of Representation
Different data types can store different sizes of data, and therefore can store more before overflow occurs.
Carry and Overflow
Both carry and overflow occur when you run out of bits in an operation, however
Overflow only has significance for signed numbers
Carry only has significance when you are using unsigned bits
Binary Multiplication
This works identically to denary long multiplication following
these rules:
0x0=0
0x1=0
1x0=0
1x1=1
An example of this would be —→
Real Numbers in Binary
To represent in floating point, we use negative powers of two to create fractions:
Power of 2 2 1 0 . -1 -2 -3
Denary
4 2 1 . 0.5 0.25 0.123
equivalent
After we have determined the whole number’s binary value, we calculate the fractional value using this algorithm:
Repeatedly multiply the decimal part by two, and remove the whole number as a 1 each time, or a 0 if there isn’t one. Read the
bits from bottom to top once you reach 0:
Intro to Computer Architecture 3
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller maiacrawford. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for £10.48. You're not tied to anything after your purchase.