Hardware 05: Memory organization

Memory organization

Random access memory RAM

Earlier we discussed the D-type level flip-flop, it can save 1 bit of information, the data terminal is named data input, the clock input is named write operation, and the two Q is named data output:

This circuit is the same type of flip-flop as the previous one, but it is named differently. The way to save the input is to set the write operation terminal from 0 to 1, because the stored data seems to be locked, so this circuit is also called a latch, and the latch can also be represented by the following symbol:

Multiple latches can be connected to store multiple bits of data at the same time:

This is an 8-bit latch. There are 8 inputs and outputs each. The write terminal is 0 in the non-working state. If you want to store data, you must first set the write terminal to 1. Then set to 0. This 8-bit latch can also be represented by the following symbols:

The input of this 8-bit latch has 8 bits. Suppose we want to make such a latch: it has only one data input terminal and one data output terminal, instead of 8, each time the data is specified to be stored in a single Among the latches, 8 latches can be stored independently. We also want to determine the actual 8-bit output by observing the output signal terminal.

Suppose we have a light bulb. When facing the 8-bit output, how can we determine what the stored number is? The easiest way is to take the light bulb and connect it to the output in turn, but that is too much trouble. We need a more automated method to check. We can set up multiple switches and output the signal of the corresponding bit to the light bulb according to different combinations of switches:

These three switches can form a three-digit binary number, which can exactly represent 8 bits. According to different switch conditions, the output of the corresponding bit is connected to the bulb. The structure of this 8-1 selector is as follows:

It consists of three inverters, eight 4-port input AND gates and an 8-port input OR gate. The truth table is as follows:

At this point, the output has completed the check function, so how to let the input be stored in a certain latch?

It can be done with the following system:

For the entire system, the three signals that play the role of selection are called address ports, that is, to see which address among the 8 bits, the decoder is responsible for outputting the input to the corresponding latch, and the selector is responsible for latching the corresponding The value in the device is output.

The 3-8 decoder is a circuit element with the opposite function of the selector. 3-8 means that there are 8 output ports and 3 selected switches. The structure is as follows:

Its function is to input data to 8 different output terminals according to different combinations of S1, S2, and S3. The truth table is as follows:

This system is called read / write memory, or random access memory, or RAM (Random Access Memory), and can be represented by the following symbols:

This kind of memory can not only store new data in each latch, but also check what data is stored in each latch, and only need to change the address and data input to complete the read and write function. Because the data of any latch can be read without sequential access, it is called random access memory.

It should be noted that RAM depends on current for data storage. Internal relay-like components must rely on current to maintain the structure of the circuit. If the power is turned off, all internal components are restored to the untriggered state, and the data will disappear , So random access memory is also called volatile memory.

RAM array

We can connect two 8 * 1 RAM arrays by sharing addresses:

Different data inputs can be stored to the same address, which is equivalent to the original storage of 8 1-bit binary numbers, and now it can be stored into 8 2-bit binary numbers, so that you get an 8 * 2 RAM array:

The RAM array can also be combined with multiple latches with selectors and decoders, using the principle of the previous RAM:

There is an additional selection terminal, which is used to select which latch the data is input to, and which latch the data output data comes from, which is equivalent to further expanding the address range. The selection terminal essentially plays the fourth address line Role, so this structure is essentially a 16 * 1 RAM array:

It can store 16 units, each unit occupies 1 bit.

The storage capacity of the RAM array is related to the number of address input terminals, and their relationship is as follows:
$$
RAM array storage capacity = 2 ^ {number of address input terminals}
$$
large-scale RAM array can store more bits The storage capacity of 1024byte = 1KB is because of the power of two relationship. A RAM array has 10 address input terminals, and it has a storage capacity of 1KB.

Operate the memory with the control panel

Suppose now that a 64KB RAM array has been constructed (16 address bits represent 65535 groups of data can be stored, one group is 8bit, equivalent to 1 byte, a total of 64KB)

The control panel to be constructed is as follows:

The top 16 switches are used to control the address bits, the bottom 8 switches are used to control the 8-bit data to be input, and the 8 bulbs are used to display 8-bit data. When the write operation terminal is 1, the data is written to the corresponding address. When the control terminal is 0, the control panel loses control of the memory. At this time, the memory is connected to other circuits, and other circuits can access the data in the memory; when the control terminal is 1, the control panel can control the memory.

We need 25 2-1 selectors to complete the function (the 2-1 selector has 2 inputs and 1 output), including 16 address input terminals, 8 data input terminals and a write operation terminal, the circuit is as follows:

When the control terminal is open, the 25 2-1 selectors will select the external signal in the upper left corner, and the external signal operates the memory at this time; when the control terminal is closed, the 25 2-1 selectors will select the switch in the upper right corner The signal sent.

The control panel control storage area not only realizes data input and reading, but also provides other components with access to the system.

Guess you like

Origin www.cnblogs.com/yinyunmoyi/p/12725630.html