<Short Answer Question> Review of Computer Composition Principles

1. Both instructions and data are placed in memory. How to distinguish whether they are instructions or data from time and space?
Answer: Generally speaking, the information flow read from the memory in the instruction fetch cycle is the instruction flow, which flows to the controller; and the information flow read from the memory in the executor cycle is the data flow, which flows from the memory to the operator.
1. There are two types of data, one is stack data, and one is heap data,
2. Global variables, static variables and constant strings are placed in the text area or global area,
3. And there is another one next to the text area. The command area is dedicated to placing commands.
They each have a segment base register pointing to theirs. So the difference is not your concern, but managed by the operating system and the process tcb block.
2. How do modern computer systems perform multi-level division? What impact will this hierarchical view have on computer design?
Answer: Modern computer systems can be divided into five levels. The first level is the microprogramming level; the second level is the general machine level; the third level is the operating system level; the third level is the operating system level; The fourth level is the assembly language level; the fifth level is the high-level language level.
The first level is the hardware system, the second level is the function extension of the software system to the hardware system, and the third level is an interface between software and hardware. This classification is not absolute or unique. For example, with the development of large-scale integrated circuits and firmware, the functions of hardware are continuously extending to the upper layers. Moreover, different hardware structures have different levels, such as a computer with a hard-wired controller, there is no microprogram level. Designing a computer with this hierarchical view is of great help in ensuring that a good system structure is produced.
3. What are the steps for the computer to realize the multiplication and division of floating point numbers?
Answer: The steps to realize multiplication and division of floating-point numbers: addition and subtraction of exponent code; multiplication and division of mantissa; formatting; rounding processing; checking for overflow.
The operation steps of floating-point multiplication and division:
①Order code operation: the summation of the order code (multiplication) or the difference of the order code (division), that is, [Ex+Ey] shift = [Ex] shift + [Ey] complement [Ex-Ey] shift = [Ex] shift + [-Ey] complement
② Mantissa processing of floating-point numbers: The result of mantissa multiplication and division in floating-point numbers should be rounded.
Example: X=0 .0110011*211, Y=0.1101101*2-10, find X※Y
solution: [X] float: 0 1 010 1100110 [Y] float: 0 0 110 1101101
Step 1: Add order code : [Ex+Ey] shift=[Ex] shift+[Ey] complement=1 010+1 110=1 000 1 000 is the 0 represented by the code shift
Step 2: The result of multiplying the mantissas of the original code is: 0
10101101101110 Step 3: Normalization processing: The normalization requirements have been met, no left gauge is required, the mantissa remains unchanged, and the order code remains unchanged.
Step 4: Rounding processing: According to the rounding rule, add 1 for correction, so X※Y= 0.1010111※2+000
4. What is the instruction cycle? The machine cycle? The clock cycle? What is the relationship between the three?
Answer: Clock cycle:
The clock cycle is also called the oscillation cycle, which is defined as the reciprocal of the clock pulse (it can be understood in this way that the clock cycle is the reciprocal of the external crystal oscillator of the microcontroller, such as a 12M crystal oscillator, its time period is 1/12 us), It is the most basic and smallest unit of time in a computer.
In one clock cycle, the CPU only completes a basic action. For a certain microcontroller, if the clock frequency of 1MHZ is adopted, the clock cycle is 1us; if the clock frequency of 4MHZ is adopted, the clock cycle is 250us. Since the clock pulse is the basic working pulse of the computer, it controls the working rhythm of the computer (so that every step of the computer is unified to its rhythm). Obviously, for the same type of computer, the higher the clock frequency, the faster the computer works. However, since different computer hardware circuits and devices are not exactly the same, the required clock cycle frequency ranges are not necessarily the same. The clock range of the 8051 microcontroller we learned is 1.2MHz-12MHz.

In the 8051 microcontroller, one clock cycle is defined as a beat (represented by P), and two beats are defined as a state cycle (represented by S).

Machine cycle:
In a computer, in order to facilitate management, the execution process of an instruction is often divided into several stages, and each stage completes a job. For example, instruction fetch, memory read, memory write, etc., each of which is called a basic operation. The time required to complete a basic operation is called the machine cycle. In general, a machine cycle consists of several S cycles (state cycles). One machine cycle of 8051 series MCU consists of 6 S cycles (state cycles). As mentioned earlier, one clock cycle is defined as one beat (represented by P), and two beats are defined as one state cycle (represented by S). The machine cycle of the 8051 microcontroller consists of 6 state cycles, that is to say, one machine cycle = 6 state cycles = 12 clock cycles.

Instruction cycle:
The instruction cycle is the time required to execute an instruction, which generally consists of several machine cycles. Different instructions require different number of machine cycles. For some simple single-byte instructions, in the instruction fetch cycle, after the instruction is fetched into the instruction register, it is decoded and executed immediately, and no other machine cycles are required. For some more complex instructions, such as branch instructions and multiplication instructions, two or more machine cycles are required.
Usually, an instruction containing one machine cycle is called a single-cycle instruction, and an instruction containing two machine cycles is called a two-cycle instruction.
5. Among the three types of instructions of register-register type, register-memory type and memory-memory type, which is the longest? Which class has the shortest execution time? Why?
Answer: The register-register type performs the fastest, and the memory-memory type performs the slowest. Because the former operand is in the register and the latter operand is in the memory, the time required to access the memory is generally longer than the time required to access the register once.
6. What are the ways of mapping between main memory and cache (cache memory)?
Answer: 1. Direct image When
using direct image, a certain block of Cache can only establish an image relationship with some fixed main memory blocks, and a certain block of main memory can only correspond to one Cache block. The advantage of direct mapping is that the hardware is simple and the cost is low; the disadvantage is that it is not flexible enough. Several blocks of the main memory can only correspond to a unique Cache block, and even if there are vacancies in the Cache, they cannot be used.

2. Fully
associative mapping When fully associative mapping is used, a certain block of the Cache can establish a mapping relationship with any main memory block, and a certain block in the main memory can also be mapped to any position in (2cache. Because a certain block of the Cache can be Establish a mapping relationship with any main memory block, so the marked part of the Cache must record all the information of the block address of the main memory block. For example, the main memory is divided into 2n blocks, the address of the block is n bits, and the mark should also be n bits. In the fully associative mapping mode, the main memory address is understood to be composed of two parts: the mark (main memory block number) and the address in the block. When the CPU accesses the memory, in order to determine whether it is a hit, the mark part of the main memory address needs to be the same as the Cache. Compare the marks of all blocks in the Cache. In order to shorten the comparison time, compare the marked part of the main memory address with the marks of all blocks in the Cache at the same time. If it hits, access the hit block in the Cache according to the address in the block (its mark is the same as the one in the Cache). The mark given by the main memory address is the same); if it is not hit, the main memory is accessed.
The advantages of the fully associative image are flexibility and high Cache utilization. There are two disadvantages: one is that the number of marked bits is increased (the main memory needs to be recorded The second is that the comparator is difficult to design and implement (usually using "content-addressable" associative memory). Therefore, only small-capacity Cache can use this image.

3. Group-Associative Mapping The
group -associative mapping approach is a compromise between direct and fully-associative mapping. Assuming that there are m blocks in the Cache, when the group-associative mapping method is adopted, the m Cache blocks are divided into u groups (sets), and each group has k blocks (that is, m=u×k). Inner fully associative image. The so-called direct mapping between groups means that the cache blocks in a group can only establish a mapping relationship with some fixed main memory blocks.
7. When designing the command system, which four aspects are usually considered?
Answer: It is very difficult to determine a unified measurement standard for the instruction system, but in general, the instruction system should meet the following basic requirements:
1. The completeness of the instruction system The completeness of the instruction system refers to the use of assembly When programming in language, the instruction system should provide enough rich instructions for easy selection during programming, that is, the instruction system is required to be rich in instructions, complete in functions and easy to use. Completeness is a basic principle. Generally speaking, a complete instruction system should include the types of instructions mentioned above.
2. Validity of the instruction system Effectiveness means that the programs compiled by the instruction system can run efficiently.
The so-called high efficiency is mainly manifested in two aspects: fast execution speed and small storage space. Effectiveness is a very complex issue, which is closely related to completeness. A fully functional instruction system must have high effectiveness. For example, the data conversion instructions, character string operation instructions, etc. added in many computers at present will undoubtedly greatly improve the effectiveness of the instruction system.
3. The regularity of the instruction system The regularity of the instruction system includes the symmetry and uniformity of the instruction, and the consistency with the data format. Symmetry of instructions means that all data storage units (such as registers, main memory units, etc.) are treated equally by the instruction system, and all instructions can use various addressing modes; uniformity of instructions refers to instructions of the same operational nature, which can be Supports operations of various data types and word lengths. For example, the addition instruction can support operations of different data types (such as fixed-point numbers, floating-point numbers, decimal numbers, etc.) and different word lengths (such as bytes, words, double words, and even quad words); the instruction format is consistent with the data format. Refers to the command length and data length have a certain relationship, in order to facilitate access and processing. The instruction length is generally an integer multiple of bytes, and the data length is 1, 2, 4 or 8 times the byte.
4. The compatibility of the instruction system Different machine structures have different instruction systems. However, models of the same series have the same basic structure and common basic instruction set, so the instruction system is compatible. Because different models in the series were launched at different times, and there are differences in structure and performance, it is impossible to achieve all software compatibility. Usually, the software of the low-end machine can be run on the high-end machine, but the software of the high-end machine may not be able to run on the low-end machine, so it is called "upward compatibility".
The basic requirements for the instruction system mentioned above are only an ideal situation. For a specific computer, it is impossible to meet all these requirements, because it requires strong hardware support, and at the same time blindly pursues a very ideal machine Also unnecessary.
8. What is the difference between synchronous communication and asynchronous communication?
Answer: 1. Synchronous communication requires the clock frequency of the receiver to be the same as the clock of the sender, and the sender sends a continuous bit stream; asynchronous communication does not require the clock of the receiver to be synchronized with the clock of the sender. After the sender sends a byte, it can The next byte is sent after an arbitrarily long time interval.
2. The efficiency of synchronous communication is high; the efficiency of asynchronous communication is low.
3. Synchronous communication is more complicated, and the allowable error of the clocks of both parties is small; asynchronous communication is simple, and the clocks of both parties can allow a certain error.
4. Synchronous communication can be used for point-to-multipoint; asynchronous communication is only suitable for point-to-point.
9. What is the principle of program locality?
Answer: The principle of program locality means that the program exhibits locality laws during execution, that is, within a period of time, the execution of the entire program is limited to a certain part of the program. Correspondingly, the storage space accessed by execution is also limited to a certain memory area. The principle of locality is manifested as: temporal locality and spatial locality. Temporal locality means that if an instruction in a program is executed once, the instruction may be executed again soon after; if some data is accessed, the data may be accessed again soon after. Spatial locality refers to once a program accesses a certain memory location, not long after. Its nearby storage units will also be accessed.
10. A machine has five interrupt sources. The priority order of interrupt response is L0, L1, L2, L3, L4. Now the priority order is changed to L3, L2, L4, L0, L1. Mask word for interrupt sources.
answer:
write picture description here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325729085&siteId=291194637