TECHNOLOGY 

Published on

KembaraXtra-Computer Science - Main Memory

1. Purpose of Main Memory
• Stores program instructions and data needed for execution.
• Example: Word processor program, document content, editing state.
• Stores data as bits (1s and 0s) that the CPU can access.

2. Types of Memory
SRAM (Static Random Access Memory):
- Uses flip-flops to store bits.
- Static: Retains data as long as power is supplied.
- Faster, more expensive.
- Used in cache memory (where speed is critical).

DRAM (Dynamic Random Access Memory):
- Uses a transistor and capacitor to store bits.
- Dynamic: Capacitor charge leaks, so data must be periodically refreshed (rewritten).
- Slower, less expensive.
- Commonly used for main memory.

3. Memory Organization
• Internally organized as grids of memory cells (each storing 1 bit).
• Cells are accessed using two-dimensional coordinates.
• Multiple grids are accessed in parallel to read/write multiple bits at once (e.g., a byte).

4. Memory Addresses
Memory Address: A numeric value that identifies a specific location in memory.
Byte-Addressable: Each memory address refers to 8 bits (1 byte) of data.

5. Example: 64KB Memory System
• Memory Size: 64KB (64 x 1024 = 65,536 bytes).
• Address Range: 0 to 65,535 (0x0000 to 0xFFFF in hexadecimal).
• Address Representation: Binary numbers.

• Calculating Bits Required for Addressing:
- 2^n = number of unique addresses
- n = log₂(number of unique addresses)
- For 65,536 bytes: log₂(65,536) = 16 bits.
- Alternatively: 0xFFFF (hex) = 4 hex characters × 4 bits/character = 16 bits.
• Significance of Number of Bits: Limits the maximum amount of memory the computer can access.

6. Memory Layout Example
• Memory addresses (in binary or hex) are associated with data bytes.
• Example: Storing the ASCII string "Hello" starting at address 0x0002:

Memory Address   Data Byte (Hex)   Data as ASCII
0000             00
0001             00
0002             48                H
0003             65                e
0004             6C                l
0005             6C                l
0006             6F                o
0007             00                (Null Term.)

Null Terminator: Some languages use a null terminator (byte equal to 0) to mark the end of a string.

7. Memory Inspection Tools
• Display memory contents in hexadecimal format.
• Show a memory address followed by 16 bytes of data at that address and the subsequent 15 addresses.

8. Modern Memory Sizes
• Modern devices have much larger memories (GBs).
• Example: Smartphones (1GB+), Laptops (4GB+).

9. Practice: Calculating Bits for 4GB Memory
• 4GB = 4 × 2³⁰ bytes = 2² × 2³⁰ = 2³² bytes
• log₂(2³²) = 32 bits required to address 4GB of memory.

Published on
KembaraXtra-Case Law-Computer Hardware Overview
I. The Essence of a Computer: Programmability
  • Limitation of Hardware-Defined Features: Hard-wiring features into a circuit's design restricts innovation and modification after manufacturing.
  • Programmability as a Key Differentiator: Computers can perform new tasks without hardware changes by accepting and executing instructions (a program).
  • Hardware vs. Software:
    • Hardware: Physical components of a computer (covered in this chapter).
    • Software: Instructions that tell the computer what to do (covered in the next chapter).
  • The ability to run software is what makes a computer a general-purpose device, instead of a fixed-purpose device
II. Minimum Hardware Requirements for a General-Purpose Computer
  1. Memory:
    • Main Memory (RAM): The primary memory used in a computer.
    • Volatility: Data is retained only while the computer is powered.
    • Random Access: Any memory location can be accessed in roughly the same amount of time.
    • A conceptual extension of simple memory devices like latches and flip-flops.
  2. Central Processing Unit (CPU):
    • Also called a processor.
    • Executes instructions specified in software.
    • Can directly access main memory.
    • Microprocessors: CPUs on a single integrated circuit (lower cost, improved reliability, increased performance).
    • A conceptual extension of digital logic circuits.
III. Input/Output (I/O) Devices
  • Necessity: Required for computers to interact with the outside world.
  • Function: Facilitate communication into the computer (input) and out of the computer (output).
  • Examples: Not explicitly mentioned in the provided text, but think of things like keyboards, mice, monitors, printers, network interfaces, etc.
Picture
Published on

KembaraXtra-Case Law-3-Bit Counter

Core Concept

  • A 3-bit counter is a digital circuit that counts from 0 to 7 in binary.
  • It consists of three memory elements (flip-flops), each representing a bit.
  • A clock signal synchronizes state changes (increments) of these bits.

Binary Counting Review

Table 6-5: Shows the decimal equivalents of 3-bit binary numbers.

Binary Decimal
000 0
001 1
010 2
011 3
100 4
101 5
110 6
111 7

Memory Element Assignment

  • Table 6-6: Assigns each bit of the 3-bit number to a memory element (Q0, Q1, Q2).
  • Q0 = Least Significant Bit (LSB)
  • Q2 = Most Significant Bit (MSB)
All 3 bits Q2 Q1 Q0 Decimal
000 0 0 0 0
001 0 0 1 1
010 0 1 0 2
011 0 1 1 3
100 1 0 0 4
101 1 0 1 5
110 1 1 0 6
111 1 1 1 7

Pattern Recognition

  • Q0: Toggles (changes state) on every clock pulse.
  • Q1: Toggles when Q0 was previously 1 (high).
  • Q2: Toggles when both Q1 and Q0 were previously 1 (high).
  • General Rule: Each bit (except Q0) toggles when all preceding bits are 1.

Implementation with T Flip-Flops

  • T flip-flops are ideal for building the counter due to their toggling behavior.
  • Figure 6-15: Illustrates the 3-bit counter circuit.
  • All flip-flops share the same clock signal for synchronization.
  • T0 is connected to 5V, ensuring Q0 toggles with each clock pulse.
  • T1 is connected to Q0, so Q1 toggles when Q0 is high.
  • T2 is connected to Q0 AND Q1, so Q2 toggles when both Q0 and Q1 are high.

Applications

  • Counters can be used in vending machines to track the number of coins inserted.
  • Up/Down counters (like the 74191 IC) can both increment and decrement the count.

Key Takeaway

  • Complex digital systems (like counters) can be built from simpler components (transistors, logic gates, flip-flops) through a process of encapsulation, hiding internal details and complexity.
Picture
Published on

KembaraXtra-Case Law-T Flip-Flop

Concept:

  • A T flip-flop is derived from a JK flip-flop.
  • It simplifies operation by connecting the J and K inputs together, treating them as a single input (T).
  • The T flip-flop either toggles its output (Q) or maintains its current value based on the T input and the clock pulse.

Functionality:

  • T = 0: On a clock pulse, the flip-flop holds its current value. Q(t+1) = Q(t). No change occurs.
  • T = 1: On a clock pulse, the flip-flop toggles its output. Q(t+1) = NOT Q(t). The output inverts.

Truth Table:

T Clock Q(t+1) Operation
0 Pulse Q(t) Hold (Maintain)
1 Pulse NOT Q(t) Toggle (Invert)

Key Points:

  • The "T" in T flip-flop stands for "Toggle".
  • The clock pulse is essential for the T flip-flop to change state (either toggle or hold). The value of T only determines what happens when the clock pulse occurs.
  • T flip-flops are useful for building counters and frequency dividers because of their toggling behavior.
Picture
Published on

KembaraXtra-Computer Science - JK Flip-Flop

1. Flip-Flops vs. Latches

  • Flip-Flop: A 1-bit memory device that uses a clock to control state changes.
  • Latch: A memory device without a clock. Changes state immediately based on input.
  • Important Note: Terminology can be inconsistent. This guide uses the definitions above.

2. JK Flip-Flop Overview

  • Purpose: A clocked 1-bit memory element.
  • Analogy to SR Latch:
    • J input acts like S (Set).
    • K input acts like R (Reset).
  • Key Differences from SR Latch:
    • i. Clocked Operation: State changes only occur with a clock pulse.
    • ii. Toggle Functionality: When both J and K are high (1), the output toggles (inverts) its state on each clock pulse.

3. JK Flip-Flop Functionality Table

J K Clock Q (Output) Operation
0 0 Pulse Maintain previous value Hold
0 1 Pulse 0 Reset
1 0 Pulse 1 Set
1 1 Pulse Inverse of previous value Toggle (Invert)

Understanding the Table: The output Q changes only on the active edge of the clock pulse, and only if J or K (or both) are high.

4. JK Flip-Flop Symbols

  • Positive Edge-Triggered: Changes state on the rising edge of the clock pulse.
  • Negative Edge-Triggered: Changes state on the falling edge of the clock pulse. Indicated by a circle on the clock (CLK) input.

5. Key Concepts to Remember

  • Clocked Operation: The flip-flop only responds to inputs J and K when a clock pulse occurs.
  • Edge-Triggering: Changes happen on a specific edge (rising or falling) of the clock pulse.
  • Toggle: J=1, K=1 inverts the output with each clock pulse.
Picture
Published on
KembaraXtra-Computer Science-SR Latch in a Vending Machine Circuit
I. Vending Machine Circuit with SR Latch
A. Requirements
  1. Inputs:
    • COIN button: Simulates coin insertion.
    • VEND button: Initiates vending.
  2. Outputs:
    • COIN LED: Indicates coin insertion.
    • VEND LED: Indicates item vending.
  3. Functionality:
    • Vending only occurs after coin insertion.
    • Only one coin insertion is considered.
    • Manual reset initially (later automatic).
B. Conceptual Implementation (Figure 6-7)
  1. COIN Button:
    • Sets the SR latch (COIN memory device).
    • COIN LED turns on.
  2. VEND Button:
    • AND gate: Requires both COIN (latch output = 1) and VEND button press.
    • If both conditions are met:
      • VEND LED turns on.
    • If no coin was inserted: nothing happens.
  3. Reset:
    • Manual reset required to clear COIN LED and reset the latch.
C. Automatic Reset Implementation (Figure 6-8)
  1. Connects the AND gate output (VEND signal) to the Reset input of the SR latch.
  2. Intended behavior: Vending resets the coin memory.
  3. Problem: Reset happens too quickly. VEND LED barely turns on (or not at all).
D. Automatic Delayed Reset (Figure 6-9)
  1. Problem: UI needs time for the user to see the action that has been performed
  2. Solution: Introduce a delay on the reset line.
  3. Implementation: Use a capacitor and resistor on the reset line.
II. Capacitors for Delay
A. Capacitor Basics
  1. Definition: An electrical component that stores energy.
  2. Terminals: Two terminals.
  3. Charging: Current flow charges the capacitor.
  4. Capacitance:
    • Measure of charge storage ability.
    • Unit: Farad (F). Commonly measured in microfarads (μF).
B. Capacitor Behavior
  1. Uncharged: Acts like a short circuit.
  2. Charged: Acts like an open circuit.
C. Delay Control
  1. Factors: Capacitance (C) and Resistance (R) in the circuit.
  2. Effect: Larger C and R = longer charging time = longer delay.



Picture
Published on
KembaraXtra-Case Law-Designing with Logic Gates
Core Idea
  • Complex logical statements/truth tables can be physically implemented using logic gates.
Example: (A AND B) OR C
  1. Logical Statement: IF it is sunny AND warm, OR it is my birthday, THEN I am going to the beach.
  2. Simplified Statement: (A AND B) OR C
  3. Logic Gate Diagram:
    • A and B are inputs to an AND gate.
    • The output of the AND gate and C are inputs to an OR gate.
    • The output of the OR gate is the final output.
  4. Functionality:
    • If both A and B are 1, the AND gate outputs 1.
    • If either the AND gate output or C is 1, the OR gate outputs 1.
Combinational Logic Circuits
  • Definition: A circuit where the output is ONLY a function of the present inputs.
  • Key Feature: A specific set of present inputs always produces the same output.
Sequential Logic (Brief Mention)
  • Definition: The output is a function of both present and past inputs.
·
  • Not covered in detail yet.
Exercise 4-2: (A OR B) AND C
  • Goal: Translate the truth table and logical expression (A OR B) AND C into a logic gate diagram.
  • Steps:
    1. Create a truth table for (A OR B) AND C (refer to Chapter 2, Exercise 2-5 if needed).
    2. Draw a logic gate diagram:
      • A and B are inputs to an OR gate.
      • The output of the OR gate and C are inputs to an AND gate.
      • The output of the AND gate is the final output.
Picture
Published on
KembaraXtra-Computer Science-Binary Addition
Core Concept:
Binary addition follows the same principles as decimal addition, but uses base-2 (only 0 and 1).
Steps for Binary Addition:
  1. Start from the Rightmost Bit (Least Significant Bit): Just like decimal addition, begin with the rightmost column.
  2. Add the Bits in Each Column: Add the two bits in the current column. Remember these rules:
    • 0 + 0 = 0
    • 0 + 1 = 1
    • 1 + 0 = 1
    • 1 + 1 = 10 (which means 0 in the current column and carry-over 1 to the next column on the left)
  3. Handle Carry-Over:
    • If the sum of two bits is "10", write down "0" in the current column and carry-over the "1" to the next column on the left.
    • If there is a carry-over from the previous column, include it when adding the bits in the current column. (You could be adding 1 + 1 + 1, which equals binary 11, resulting in a sum of 1 and a carry-over of 1.)
  4. Repeat for All Columns: Continue adding each column, moving from right to left, until you've added all the bits, including any final carry-over.
  5. Final Carry-Over: If after adding the most significant bits there is still a carry-over, write it down to the left of your result.
Outputs of Binary Addition:
Each binary addition operation produces two key outputs:
  • Sum Bit (S): This is the result of the addition for the current column (either 0 or 1). This is the rightmost digit of the operation.
  • Carry-Out Bit (Cout): This is the bit that is carried over to the next column if the sum of the current column is 2 (binary 10) or greater.
Sanity Check:
To verify your binary addition, you can convert the binary numbers to decimal, perform the addition in decimal, and then convert the decimal result back to binary.
Example:
0010 + 0011 = 0101
  • Rightmost (LSB): 0 + 1 = 1
  • Next Bit: 1 + 1 = 10 (0 with a carry-over of 1)
  • Next Bit: 0 + 0 + 1 (carry-over) = 1
  • Leftmost (MSB): 0 + 0 = 0
Result: 0101
Conversion to Decimal for Verification:
  • 0010 (binary) = 2 (decimal)
  • 0011 (binary) = 3 (decimal)
  • 2 + 3 = 5 (decimal)
  • 0101 (binary) = 5 (decimal) - Confirmed!
Picture
Published on

KembaraXtra – Computer Science – Integrated Circuits

I. Introduction to Integrated Circuits (ICs)

Definition: An integrated circuit (IC), also known as a "chip," contains multiple electronic components (transistors, resistors, etc.) on a single piece of silicon. It is packaged with external pins for electrical connections.

Advantage over Discrete Components:

  • Smaller size
  • Faster operation
  • Lower cost

II. Integrated Circuit Packaging

Dual In-Line Package (DIP): A common IC package with a rectangular shape and two parallel rows of pins. Suitable for breadboard use.

III. Evolution of Logic Circuits

  • Resistor-Transistor Logic (RTL): Early logic circuits built using resistors and transistors.
  • Diode-Transistor Logic (DTL): An improved logic family that uses diodes and transistors.
  • Transistor-Transistor Logic (TTL): A widely used logic family that uses transistors.

IV. The 7400 Series

Description: A popular line of TTL logic circuits introduced in the 1960s, still widely used today. It includes logic gates and other digital components.

  • Operating Voltage (Vcc): Typically 5V.
  • Logical 1 (High): Ideally 5V, but typically registers between 2V and 5V.
  • Logical 0 (Low): Ideally 0V, but is considered low between 0V and 0.8V.

V. Example: The 7432 IC (Quad OR Gate)

  • Function: Contains four independent OR gates.
  • Package: 14-pin DIP.
  • Pin Configuration:
    • Each OR gate uses 3 pins (2 inputs, 1 output).
    • 1 pin for Vcc (positive voltage).
    • 1 pin for Ground (GND).
  • Orientation: A half-circle notch on the package indicates the correct pin orientation.
  • Breadboard Placement: Straddle the gap in the center of the breadboard to avoid accidental connections between opposite pins.

VI. Pinout Diagrams

Definition: A diagram that labels the electrical contacts (pins) of an electronic component.

Purpose: Shows the external connection points of the component. Does not usually document the internal design.

Usage: Use the pinout diagram to identify the function of each pin and connect them appropriately.

VII. Connecting a Single OR Gate in a 7432 IC (Example)

Pin Connection Description
1 Connect to 5V or GND A input of the OR gate (5V = 1, GND = 0)
2 Connect to 5V or GND B input of the OR gate (5V = 1, GND = 0)
3 Expect 5V or GND Output of the OR gate (5V = 1, GND = 0)
7 Connect to Ground (GND) Ground connection for the IC
14 Connect to 5V power source (Vcc) Power supply for the IC

VIII. Common 7400 Series ICs

  • The 7400 series contains hundreds of components, including various logic gates.
  • Pinout diagrams for different 7400 series ICs can be found online.
Published on
KembaraXtra-Computer Science-Sequential Logic Circuits and Memory
1. What are Sequential Logic Circuits?
  • Definition: Digital circuits where the output depends on:
    • The present inputs.
    • The past inputs (history/state of the circuit).
  • Key Feature: Possess "memory" of past events.
2. The Role of Memory
  • Purpose: Stores a record of the circuit's past state.
  • Function: Allows for the storage and retrieval of binary data.
  • Importance: Enables sequential logic.
3. Example: Coin-Operated Vending Machine
  • Inputs: Coin slot, vend button.
  • Behavior: The vend button only works if a coin has already been inserted.
  • Why it's Sequential:
    • The machine "remembers" (stores in memory) whether a coin has been inserted.
    • The output (dispensing an item) depends on both:
      • The present input (vend button press).
      • The past input (coin insertion).
  • Contrast with Combinational Logic: A combinational logic vending machine would require simultaneous coin insertion and button press.
4. Memory Capacity
  • What Memory Stores: Binary data (bits).
  • Units of Measurement:
    • Bits: Basic unit of memory (0 or 1).
    • Bytes: Groups of 8 bits.
  • Modern Devices: Have large memory capacities (e.g., 1 GB = over 8 billion bits).



Picture