1 Binary Systems

Digital Logic · Unit 1 · 6 hrs

Binary Systems

Exam-focused notes for Binary Systems (Digital Logic, CSC116): what the TU syllabus asks and how it has actually been tested, with 7 solved past questions from this unit.

Binary Systems in short

This chapter introduces how a digital system represents and stores information: the binary number system and its conversions to and from octal and hexadecimal, the arithmetic techniques (complements and signed representation) that let a circuit subtract using only adders, the decimal and alphanumeric codes used to move data in and out of a machine, and the basic idea of a binary storage element.

Binary Systems: notes

Digital Systems

A digital system processes information that is represented using a finite set of discrete values, in contrast to an analog system, where a quantity varies continuously over a range. Almost all modern digital systems use just two discrete values and are therefore called binary systems, with the two values denoted by the digits 0 and 1 and referred to as logic levels. Physically, these two levels correspond to two easily distinguishable ranges of a physical quantity, most often voltage: a relatively high value represents logic 1 and a relatively low value represents logic 0.

Digital systems are preferred over analog ones for information processing because binary circuits are comparatively simple to design and are far more tolerant of electrical noise: a signal only has to be recognized as belonging to one of two ranges rather than measured precisely. This tolerance makes digital data easy to store, reproduce exactly, and transmit without accumulating error, which is why computers, calculators, digital instruments and digital communication equipment are all built on binary logic.

Binary numbers

The binary number system is a positional (radix) number system with base, or radix, 2, using only the two digits 0 and 1 (called bits). As in the familiar decimal system, the value contributed by a digit depends on its position: each position carries a weight equal to the base raised to that position's power, counted from 0 at the rightmost digit and increasing to the left (and decreasing, as negative powers, to the right of a radix point).

For an integer, the decimal value of a binary number $(b_{n-1} b_{n-2} \ldots b_1 b_0)_2$ is

$$ V = \sum_{i=0}^{n-1} b_i \cdot 2^i $$

For example, the binary number $1011_2$ is evaluated as

$$ \begin{aligned} 1011_2 &= 1 \times 2^3 + 0 \times 2^2 + 1 \times 2^1 + 1 \times 2^0 \ &= 8 + 0 + 2 + 1 \ &= 11_{10} \end{aligned} $$

A binary number can also have a fractional part after a radix point, with digits to the right carrying weights $2^{-1}, 2^{-2}, \ldots$; for instance $101.1_2 = 4 + 1 + 0.5 = 5.5_{10}$.

Number base conversion

Converting a binary (or any radix-$r$) integer to decimal is done exactly as above, by summing each digit multiplied by its positional weight. The reverse direction, converting a decimal integer to binary, is done by repeated division by 2: divide the number by 2, record the remainder, and repeat on the quotient until the quotient is 0. The binary equivalent is the sequence of remainders read from the last one obtained back to the first. For example, converting $25_{10}$ to binary:

$$ \begin{aligned} 25 \div 2 &= 12 \text{ remainder } 1 \ 12 \div 2 &= 6 \text{ remainder } 0 \ 6 \div 2 &= 3 \text{ remainder } 0 \ 3 \div 2 &= 1 \text{ remainder } 1 \ 1 \div 2 &= 0 \text{ remainder } 1 \end{aligned} $$

Reading the remainders from bottom to top gives $25_{10} = 11001_2$. The same procedure, generalized to divide by any radix $r$ instead of 2, converts a decimal integer to octal ($r=8$) or hexadecimal ($r=16$) directly, and a decimal fraction is converted the same way in reverse, by repeated multiplication by $r$, reading off the integer part produced at each step.

What this unit covers

  • Digital Systems
  • Binary numbers
  • Number base conversion
  • Octal and hexadecimal numbers
  • compliments
  • Signed Binary numbers
  • Decimal codes (BCD, 2 4 2 1,8 4 -2 -1,Excess 3, Gray Code)
  • Binary Storage and Registers
  • Binary logic

compliments

2081 · 5 marks

Given A=46 and B=35 represent them in binary and perform A-B using 1's complement method. [5]

Show solved answer

A − B Using 1's Complement Method

Given

  • $A = 46$ (minuend)
  • $B = 35$ (subtrahend)
  • Operation: $A - B$ using 1's complement.

Solution

Convert to 8-bit binary

$46_{10}$: $32+8+4+2 = 46 \Rightarrow 0010,1110$

$35_{10}$: $32+2+1 = 35 \Rightarrow 0010,0011$

DecimalBinary (8-bit)
$A = 46$$0010,1110$
$B = 35$$0010,0011$

1's complement of B (invert all bits)

$$B = 0010,0011 ;\Rightarrow; \overline{B} = 1101,1100$$

Add A and 1's complement of B

    0010 1110    (A)
  + 1101 1100    (1's comp of B)
  -----------
  1 0000 1010
  ^
  carry out = 1

End-around carry

A carry out of the MSB occurred, so add it back to the sum:

    0000 1010
  +         1
  -----------
    0000 1011

Result

$$0000,1011_2 = 8 + 2 + 1 = 11_{10}$$

Since a carry-out (end-around carry) was produced, the result is positive.

Check: $46 - 35 = 11$ ✓

Summary

StepValue
$A$$0010,1110$
$B$$0010,0011$
$\overline{B}$$1101,1100$
$A + \overline{B}$$1\ 0000,1010$
After end-around carry$0000,1011$
Final Result$0000,1011_2 = 11_{10}$
Open this answer on its own page →

2080 · 5 marks

Question

Perform the following operations:

a. $(0111010)_2 - (110011)_2$ using 2's complement

b. $(89344){10} - (98654){10}$ using 9's complement

[2.5+2.5]

  • Part (a): $(0111010)2 - (110011)2$ using 2's complement - Part (b): $(89344){10} - (98654){10}$ using 9's complement --- - Minuend: $0111010$ (7 bits) - Subtrahend: $110011 \to 0110011$ (padded to 7 bits) 1's complement (flip bits): $$0110011 \to 1001100$$ Add 1: $$1001100 + 1 = 1001101$$ Colum...
Open this answer on its own page →

2079 · 5 marks

Carry out the following tasks:a. Perform 2's complement subtraction of 010110 - 100101b. Represent decimal number 10 in its BCD form [5]

  • Part a: Subtraction $010110 - 100101$ (both 6-bit binary numbers) - Part b: Represent decimal 10 in BCD --- - Minuend $A = 010110$ - Subtrahend $B = 100101$ 1's complement (invert bits): $$100101 \rightarrow 011010$$ Add 1: $$011010 + 1 = 011011$$ So 2's complement of $B = 011011$ There is no c...
Open this answer on its own page →

2078 · 5 marks

Carry out the following tasks: a. Perform 1's complement subtraction of 10101-100101 b. Represent decimal number 0.125 into its binary form [2.5+2.5]

  • Part (a): Subtraction $10101 - 100101$ using 1's complement method - Part (b): Convert decimal $0.125$ to binary --- - Minuend: $10101 = 21{10}$ - Subtrahend: $100101 = 37{10}$ Pad minuend to 6 bits: - Minuend: $010101$ - Subtrahend: $100101$ Flip all bits of $100101$: $$100101 \rightarrow 0110...
Open this answer on its own page →

Binary logic

2078 · 5 marks

Write short notes on (Any Two): Negative Logic, CMOS, EBCDIC [5]

Show solved answer

Short Notes (Any Two): Negative Logic, CMOS, EBCDIC


1. Negative Logic

Definition: In digital systems, logic levels are represented by two voltage levels. The assignment of these voltage levels to logic 0 and logic 1 defines the logic convention used.

  • In Positive Logic: The higher voltage level represents logic 1 and the lower voltage level represents logic 0.
  • In Negative Logic: The lower voltage level represents logic 1 and the higher voltage level represents logic 0.

Key Points:

Voltage LevelPositive LogicNegative Logic
High (H)10
Low (L)01

Effect on Gates:

  • A gate that functions as an AND gate in positive logic behaves as an OR gate in negative logic, and vice versa.
  • This is a direct consequence of De Morgan's theorem.

Example:

  • A positive logic AND gate with inputs A, B and output F:
    • F = A · B (positive logic)
    • The same physical gate in negative logic performs: F = A + B (OR operation)

Significance:

  • The choice of logic convention does not change the physical hardware; it only changes the interpretation of the signals.
  • Negative logic is sometimes used to simplify circuit design or to match the active-low nature of certain hardware signals.

2. CMOS (Complementary Metal Oxide Semiconductor)

Definition: CMOS is a widely used technology for constructing integrated circuits. It uses a complementary pair of p-type (PMOS) and n-type (NMOS) Metal Oxide Semiconductor Field Effect Transistors (MOSFETs) to implement logic functions.

Basic Structure:

  • Every CMOS gate consists of two networks:
    • Pull-Up Network (PUN): Made of PMOS transistors, connects output to V_DD (logic 1) when active.
    • Pull-Down Network (PDN): Made of NMOS transistors, connects output to GND (logic 0) when active.
  • PUN and PDN are always complementary -- when one conducts, the other does not.

CMOS Inverter (NOT Gate):

        VDD
         |
       [PMOS]  <-- Gate Input A
         |
         +----> Output F = A'
         |
       [NMOS]  <-- Gate Input A
         |
        GND
  • When A = 1: NMOS ON, PMOS OFF → Output = 0
  • When A = 0: NMOS OFF, PMOS ON → Output = 1

Characteristics of CMOS:

FeatureDescription
Power ConsumptionVery low (static power near zero)
Noise MarginHigh
Fan-outHigh
SpeedModerate to high
IntegrationVery high density possible

Advantages:

  • Very low power dissipation -- power is consumed only during switching transitions.
  • High noise immunity.
  • Operates over a wide range of supply voltages (typically 3V to 15V).
  • Suitable for VLSI design due to high packing density.

Applications:

  • Microprocessors, memory chips (RAM, ROM), digital logic circuits, mobile devices.

3. EBCDIC (Extended Binary Coded Decimal Interchange Code)

Definition: EBCDIC is an 8-bit character encoding standard developed by IBM for use in its mainframe and midrange computer systems. The name stands for Extended Binary Coded Decimal Interchange Code.

Key Features:

FeatureDetail
Bit Length8 bits per character
Total Characters2^8 = 256 possible characters
Developed byIBM
Used inIBM mainframes, AS/400 systems

Structure:

  • The 8 bits are divided into:
    • 4 zone bits (higher order bits)
    • 4 numeric bits (lower order bits)
  • This is an extension of the older 6-bit BCD (Binary Coded Decimal) code.

Example of EBCDIC Codes:

CharacterEBCDIC Code (Hex)EBCDIC Code (Binary)
AC11100 0001
BC21100 0010
0F01111 0000
1F11111 0001

Comparison with ASCII:

FeatureASCIIEBCDIC
Bits7/8 bits8 bits
DeveloperANSIIBM
UsageUniversal (PCs, Internet)IBM mainframes
Characters128/256256

Significance:

  • EBCDIC was one of the earliest standardized character encoding systems.
  • It is not compatible with ASCII, which often requires conversion when transferring data between IBM mainframes and other systems.
  • Despite being largely replaced by ASCII and Unicode in modern systems, EBCDIC is still used in legacy IBM mainframe environments.

Note: Two of the above three topics are to be answered as per the question requirement (Any Two). All three are provided here for completeness.

Open this answer on its own page →

Signed Binary numbers

2077 · 5 marks

List two major characteristics of digital computer. Represent -6 (negative six) using 8 bits in signed magnitude, signed-1's-complement and signed-2's-complement respectively. Represent decimal number 4673 in a) octal, and b) BCD. [5]

  • Number to represent in 8-bit signed forms: $-6$ - Decimal number to convert: $4673$ (to octal and BCD) --- 1. Operates on discrete/binary data: A digital computer represents and processes all data as discrete binary values (0s and 1s) using logic gates. 2. High accuracy and reliability: Because...
Open this answer on its own page →

Number base conversion

2075 · 5 marks

Convert the following decimal numbers to the indicated bases. a) 7562.45 to octal b) 1938.257 to hexadecimal c) 175.175 to binary [2+1.5+1.5]

  • a) $7562.45{10}$ to octal (base 8) - b) $1938.257{10}$ to hexadecimal (base 16) - c) $175.175{10}$ to binary (base 2) --- Division Quotient Remainder ------------------------------- $7562 \div 8$ 945 2 (LSB) $945 \div 8$ 118 1 $118 \div 8$ 14 6 $14 \div 8$ 1 6 $1 \div 8$ 0 1 (MSB) Reading upwar...
Open this answer on its own page →