Skip to content

Commit e4ba630

Browse files
committed
docs(notes): add assembly and memory system notes
1 parent 7160865 commit e4ba630

File tree

2 files changed

+130
-0
lines changed

2 files changed

+130
-0
lines changed

Diff for: notes/2025-04-15-assembly-programming-en.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: assembly-programming
3+
lang: en
4+
layout: post
5+
audio: false
6+
translated: false
7+
generated: true
8+
---

Diff for: notes/2025-04-15-memory-systems-en.md

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
---
2+
title: Memory Systems Tutorial
3+
lang: en
4+
layout: post
5+
audio: false
6+
translated: false
7+
generated: true
8+
---
9+
10+
This tutorial covers the key concepts of memory systems, focusing on memory classification, RAM/ROM principles, and address decoding techniques. Let's break this down into comprehensive sections.
11+
12+
## 1. Memory Classification
13+
14+
Computer memory can be broadly classified into two main categories:
15+
16+
### 1.1 By Function
17+
- **Primary Memory**: Directly accessible by the CPU
18+
- RAM (Random Access Memory): Temporary storage
19+
- ROM (Read-Only Memory): Permanent storage
20+
- **Secondary Memory**: External storage devices (hard drives, SSDs, etc.)
21+
22+
### 1.2 By Data Retention
23+
- **Volatile Memory**: Loses data when power is off (most RAM)
24+
- **Non-volatile Memory**: Retains data without power (ROM, Flash)
25+
26+
### 1.3 By Access Method
27+
- **Random Access**: Any location can be accessed directly (RAM, ROM)
28+
- **Sequential Access**: Data accessed in sequence (magnetic tapes)
29+
30+
## 2. RAM Working Principles
31+
32+
RAM (Random Access Memory) is the computer's main working memory.
33+
34+
### 2.1 DRAM (Dynamic RAM)
35+
- Stores each bit in a tiny capacitor and transistor
36+
- Requires periodic refresh to maintain data (typically every few milliseconds)
37+
- Higher density, lower cost, more common in main memory
38+
- Operation cycle: row address strobe (RAS) → column address strobe (CAS) → data access
39+
40+
### 2.2 SRAM (Static RAM)
41+
- Uses flip-flop circuits to store each bit
42+
- Doesn't need refreshing, retains data as long as power is supplied
43+
- Faster, but more expensive and lower density than DRAM
44+
- Used in cache memory
45+
46+
### 2.3 RAM Organization
47+
- Organized in a matrix format of rows and columns
48+
- Each cell has a unique address (row + column)
49+
- Data bits are typically organized in word lengths (8, 16, 32, 64 bits)
50+
51+
## 3. ROM Working Principles
52+
53+
ROM (Read-Only Memory) stores permanent or semi-permanent data.
54+
55+
### 3.1 Types of ROM
56+
- **Mask ROM**: Programmed during manufacturing, cannot be modified
57+
- **PROM (Programmable ROM)**: Can be programmed once by the user
58+
- **EPROM (Erasable PROM)**: Can be erased with UV light and reprogrammed
59+
- **EEPROM (Electrically EPROM)**: Can be electrically erased and reprogrammed
60+
- **Flash Memory**: Modern form of EEPROM, allows block-wise erasure
61+
62+
### 3.2 ROM Operation
63+
- Contains pre-written data at manufacture or programming time
64+
- Reading: Address → decoder → sense amplifier → output buffers
65+
- Writing (for writable types): Higher voltage used to modify the storage cells
66+
67+
## 4. Memory Expansion
68+
69+
As programs become more complex, memory expansion is often necessary.
70+
71+
### 4.1 Capacity Expansion
72+
- **Chip Selection**: Using multiple memory chips to increase total memory
73+
- **Word Length Expansion**: Combining chips to increase data bus width
74+
- **Address Space Expansion**: Increasing addressable memory space
75+
76+
### 4.2 Memory Banks
77+
- Memory organized into banks that can be accessed independently
78+
- Allows for interleaving, reducing average access time
79+
- Facilitates parallel operations in modern architectures
80+
81+
## 5. Address Decoding Techniques
82+
83+
Address decoding is crucial for accessing the correct memory location.
84+
85+
### 5.1 Linear Selection (Full Decoding)
86+
- Each address line directly connects to one memory location
87+
- Simple but inefficient for large memory spaces
88+
- Example: In a system with 16 address lines, we need 2^16 (65,536) individual connections
89+
90+
### 5.2 Decoder-Based Selection
91+
- **Address Decoders**: Convert binary address to one-hot selection signals
92+
- **2-to-4 Decoder**: Takes 2 address bits, activates one of 4 output lines
93+
- **3-to-8 Decoder**: Takes 3 address bits, activates one of 8 output lines
94+
- Common ICs: 74LS138 (3-to-8), 74LS154 (4-to-16)
95+
96+
### 5.3 Partial Decoding
97+
- Not all address bits are decoded, conserving hardware
98+
- Multiple memory locations may map to the same physical location
99+
- Creates memory "shadows" or "mirrors"
100+
101+
### 5.4 Memory Mapping
102+
- **Contiguous Mapping**: Memory blocks arranged sequentially
103+
- **Paged Mapping**: Memory divided into fixed-size pages
104+
- **Segmented Mapping**: Memory divided into variable-sized segments
105+
106+
## 6. Implementation Examples
107+
108+
### 6.1 Simple RAM Expansion Example
109+
To expand a 32K × 8 RAM system to 128K × 8:
110+
1. Use four 32K × 8 RAM chips
111+
2. Use 2 higher-order address bits to select among the four chips
112+
3. Connect remaining address lines to all chips in parallel
113+
4. Use a 2-to-4 decoder for chip selection
114+
115+
### 6.2 Address Decoding Circuit
116+
117+
For a system with memory mapped at address range 0x8000-0x9FFF:
118+
1. Address lines A15-A13 must be "100" (for 0x8000-0x9FFF)
119+
2. Use AND gates to detect this pattern
120+
3. Enable the appropriate memory chip when this pattern is detected
121+
122+
This completes our overview of memory systems, focusing on classification, working principles, and expansion techniques. The understanding of these concepts is fundamental to designing and working with computer systems effectively.

0 commit comments

Comments
 (0)