1
$\begingroup$

I have read Charles Petzold's Code: The Hidden Language of Computer Hardware and Software. On page 200 and onwards he introduces two RAM arrays called code and data. The code RAM array have instructions like ADD and Halt and this instructions are assigned hexadecimal numbers. For example ADD is 20h. ADD he explains means the output of the adder is sent to the latch as input or send the output of the ram to the adder. He never explains how the data RAM knows how execute the instructions. He assumes when 20h comes as input into the data array it knows what it means.

$\endgroup$

2 Answers 2

3
$\begingroup$

CPUs execute instructions. RAM just stores data and responds to requests from the CPU. The RAM doesn't execute the instructions; the CPU does.

$\endgroup$
3
$\begingroup$

Your example is exactly a control unit reading bytes from a “code ram array” and interpreting it as instructions.

In principle you could create an array storing instruction words where each word comes with a complete control unit. The problem is that this is extremely complicated, and control units are big. My laptop has storage for up to 4 billion instructions (and there are much bigger ones), but that wouldn’t be enough for a few thousand control units.

And such a design (which is really complex and my head hurts just thinking about it) would have a huge bottleneck with the data ram array.

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.