【正文】
to do so. 4. The ALU could be as simple as an 8 bit adder, or it might be able to add, subtract, multiply and divide 8 – bit values. Let’s assume the latter here. 5. The test register is a special latch that can hold values from parisons performed in the ALU. An ALU can normally pare two numbers and determine if they are equal, if one is greater than the other, etc. The test register can also normally hold a carry bit from the last stage of the adder. It stores these values in flipflops and then the instruction decoder can use the values to make decisions. 6. There are six boxes marked “3State” in the diagram. These are tristate buffers[5]. A tristate buffer can pass a 1, a 0 or it can essentially disconnect its output. A tristate buffer allows multiple outputs to connect to a wire, but only one of them to actually drive a 1 or a 0 onto the line. 7. The instruction register and instruction decoder are responsible for controlling all of the other ponents. Although they are not shown in this diagram, there would be control lines from the instruction decoder that would: the A register to latch the value currently on the data bus the B register to latch the value currently on the data bus the C register to latch the value currently on the data bus the program counter register to latch the value currently on the data bus the address register to latch the value currently on the data bus the instruction register to latch the value currently on the data bus the program counter to increment the program counter to reset to zero any of the six tristate buffers (six separate lines) 10. Tell the ALU what operation to perform 11. Tell the test register to latch the ALU’s test bibs 12. Activate the RD line 13. Activate the WR line Coming into the instruction decoder are the bits from the test register and the clock line, as well as the bits from the instruction register. RAM and ROM the address and data buses, as well as the RD and WR lines connect either to RAM or ROMgenerally both. In our sample microprocessor, we have an address bus 8 bits wide and a data bus 8 bits wide. That means that the microprocessor can address (28) 256 bytes of memory, and it can read or write 8 bits of the memory at a time. Let’s assume that this simple microprocessor has 128 bytes of ROM starting at address 0 and 128 bytes of RAM starting at address 128. ROM stands for readonly memory. A ROM chip is programmed with a permanent collection of preset bytes. The address bus tells the ROM chip which byte to get and place on the data bus. When the RD line changes state, the ROM chip presents the selected byte onto the data bus. RAM stands for randomaccess memory. RAM contains bytes of information, and the microprocessor can read or write to those bytes depending on whether the RD or WR line is signaled. One problem with today’s RAM chips is that they forget everything once the power goes off. That is why the puter needs ROM. By the way, nearly all puters contain some amount of ROM (it is possible to create a simple puter that contains no RAMmany microcontrollers do this by placing a handful of RAM bytes on the