가상 프로세서(16-bit M/C)에서, 산술연산 A+B=C 와 C*B=A를 순차적으로수행하는 기계어 및 어셈블리 프로그램 작성한 후, 이의 실행 과정(Fetch -> Decode -> Execute 사이클 포함)을 컴퓨터 하드웨어와 연관지어 설명하기.
- 데이터 A,B,C는 각각 주기억장치 주소 FA,EB,DC에 있음.
- 레지스터 : R1,R2,R3 총 3개만을 사용, 곱하기 명령어(MUL) Opcode : 14(10진수)
기계어는 연산자와 피연산자로 구성이 되어있다. 주어진 과제는 16bit-M/C이므로, 4비트 연산자와 12비트 피연산자로 작성한다. 데이터 A,B,C가 각각 주기억장치 주소 FA,EB,DC에 있는 것 확인.
---------덧셈과정----------
(기계어) (어셈블리)
①
0010 0001 1100 1010 LOAD R1 A
0010 0010 1101 1011 LOAD R2 B
0110 0011 0001 0010 ADD R3 R1 R2
0011 0011 1111 1100 STORE R3 C
---------곱셈과정---------
(기계어) (어셈블리)
0010 0001 1111 1100 LOAD R1 C
0010 0010 1101 1011 LOAD R2 B
1110 0011 0001 0010 MUL R3 R1 R2
0010 0011 1100 1010 STORE R3 A
PC와 IR을 통해, 주기억장치에 있는 내용을 CPU내 레지스터로 가져오는 것을 ‘호출’이라고 한다. 주기억장치에 가서 데이터를 복사한 후 IR에 저장해가지고 내가 뭘 해야 할지를 아는 과정(해석)하는 것을 Decoder라고 한다. 명령에 필요한 데이터가 들어왔으면 실행(Execute)를 시킨다. 이 과정이 명령어처리 사이클이다. 프로그램 코드가 이 Fetch-Decode-Execute단계를 반복 수행하게 되는 것이다. 위 덧셈과 곱셈 연산을 정리하자면(위 기계어 처리과정①을 보자면),
(1) Fetch 사이클 : PC 레지스터가 FA주소값을 가짐→프로세서가 PC레지스터 값에 해당하는 주기억장치 주소FA에 가서 내용A을 복사→IR레지스터에 저장→PC의 값은 다음 메모리 주소로 증가→앞의 처리과정 계속 반복(FA,EB,DC에 있는 값이 레지스터 IR에 저장됨)
(2) Decode 사이클 : Fetch 사이클에서 가져온 기계어 비트열을 해석하고 연산자 유형에 따라 피연산자 필드를 적절히 나눈다.
(3) Execute 사이클 : 레지스터IR의 비트열에 해당하는 신호를 ALU장치와 범용 레지스터 및 주기억장치에 보내 기계어 명령어를 수행한다.
In a virtual processor (16-it M/C), create a machine and assembly program that sequentially performs arithmetic operations A+B=C and C*B=A, then relate its execution process (including the Fetch -> Decode -> Execute cycle) to computer hardware.
- Data A, B, and C are each in the main memory address FA,EB,DC.
- Register : R1,R2,R3 using a total of three, multiplying command (MUL) Opcode : 14 (decimal)
The machine language consists of operators and operands. Because the given task is 16bit-M/C, it is written with a four-bit operator and a 12-bit operand. Ensure that data A,B,C are each in the main memory address FA,EB,DC.
---------Additional process------------
① (mechanical) (assembly)
0010 0001 1100 1010 LOAD R1 A
0010 0010 1101 1011 LOAD R2 B
0110 0011 0001 0010 ADD R3 R1 R2
0011 0011 1111 1100 STORE R3 C
--------- Multiplication process---------
(mechanical) (assembly)
0010 0001 1111 1100 LOAD R1 C
0010 0010 1101 1011 LOAD R2 B
1110 0011 0001 0010 MUL R3 R1 R2
0010 0011 1100 1010 STORE R3 A
Through PC and IR, bringing the contents of the periodic memory into the in-CPU register is called 'call'. It is called Decoder to go to the periodic memory, copy the data, save it in the IR, and interpret (interpretation) what I should do. When the data required for the command is received, execute the data. This process is a command processing cycle. The program code will repeat this Fetch-Decode-Execute step. To sum up the addition and multiplication operations above (see machine language processing 1 above),
(1) Fetch Cycle: PC register has FA address value →Processor goes to the PC LEGister value and copies contentA to the main memory addressFAFASave it into the IR LEGister→PC value increases to the following memory address →Continue processing (FA, EB, DC values are stored in register IR)
(2) Decode Cycle: Interpret the machine language bit series from the Fetch cycle and divide the operand fields appropriately according to the operator type.
(3) Execute Cycle : sends a signal corresponding to the bit column of registerIR to the ALU unit, general purpose register, and periodic memory to perform the machine command.
'개발정보 > HardwareDesign' 카테고리의 다른 글
Battery Charger IC ME4057 considerations (0) | 2020.12.17 |
---|---|
PSR ink, Solder Mask, Paste Mask(=Metal mask) (0) | 2020.12.16 |
Chip antenna PCB design 칩 안테나 pcb 디자인 (0) | 2020.12.14 |
OS에서 프로그램(Program), 잡(Job), 프로세스(Process), 프로세서(Processor)의 연관 관계 (0) | 2020.11.22 |
하드디스크의 용량(Capacitor) 구하기 (0) | 2020.11.22 |
댓글