archive-of-lena
iOS
Swift
UIKit
회고
Computer Science
Networking
짧은 메모
방명록
Home
Lena's Archive
iOS
Swift
UIKit
회고
Computer Science
컴퓨터구조
Networking
짧은 메모
방명록
컴퓨터구조
1. MIPS Introduction
H
Mar 4, 2024
2. Arithmetic Instructions
H
Mar 9, 2023
3. Data Transfer Instructions
H
Mar 16, 2023
r-format
i-format
lw
sw
lb
sb
4. Logical & Shift Instructions
H
Mar 21, 2023
2. Arithmetic Instructions
Levels of Program Code
Register File in Verilog
module
쓰기
읽기
Example
Instructions Fields
add
sub
Levels of Program Code
Register File in Verilog
module
쓰기
읽기
Example
Instructions Fields
add
sub
Created by
H
HM
Date
Mar 9, 2023
Levels of Program Code
•
컴파일러의 역할
◦
high-level 언어를 어셈블리 언어로 바꾸는 것까지
◦
→ one to many 매핑 (여러 컴퓨터에 하나의 컴파일러로 가능)
•
어셈블러의 역할
◦
기계어로 바꾸는 역할
◦
→ one to one 매핑 (컴퓨터마다 다른 매핑)
•
high-level L
◦
Portability가 높다 → 이식성이 높다
Register File in Verilog
https://s3-us-west-2.amazonaws.com/secure.notion-static.com/5a04e603-f1c3-4177-ade0-6045e4383cb1/%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA_2023-03-08_%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE_12.33.36.png
s3-us-west-2.amazonaws.com
module
•
module
module 단위로 설계한다
◦
레지스터파일을 가져오고싶으면 레지스터파일도 모듈이라고 간주해야 함
◦
module
로 시작하고 모든 코드가 끝난 뒤
endmodule
로 끝낸다
2023년 3월 9일
쓰기
•
매 클락 라이징엣지 && writing enable 일 때만
◦
<=
(non-blocking assignment) 대소관계가 아닌 assign!
◦
=
(blocking assignment) 도 assign
읽기
•
조합회로로 이뤄짐
◦
ra1이 가리키고 있는 레지스터의 값을 rd1에 내뱉음
◦
assign rd1 = (ra1 != 0) ? rf[ra1] : 0;
◦
→ ra1 address가 0이 아닐 때만 처리해라
◦
→ 0이면 0을 강제로 내뱉는다
•
0번 레지스터는 원하는 값을 쓸 수 있는 것이 아닌
항상 0으로 고정되어 있음
(0 32bit로 이뤄져있음)
→ 0을 32개 보관하는 레지스터
◦
read-only register
◦
쓰기를 시도한다고 해서 0이외의 값이 쓰여지는 것은 아님
⇒ 그래서 0을 내뱉도록 디자인 하는 것
•
유용한 경우
◦
카피할 때 0번 레지스터 값을 더해서 옮기면 카피와 동일한 역할
◦
→ 명령어
set
을 쓰지 않고도 가능
Example
•
sub $7 $7 $2
→
•
https://s3-us-west-2.amazonaws.com/secure.notion-static.com/f2fc93eb-97c8-4726-a0e9-905afdd826c7/%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA_2023-03-09_%E1%84%8B%E1%85%A9%E1%84%8C%E1%85%A5%E1%86%AB_11.50.41.png
s3-us-west-2.amazonaws.com
Instructions Fields
•
MIPS 명령어는 필드로 구성되어 있음
•
https://s3-us-west-2.amazonaws.com/secure.notion-static.com/9943a2d0-db54-417b-8ed9-186083ca0317/%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA_2023-03-09_%E1%84%8B%E1%85%A9%E1%84%8C%E1%85%A5%E1%86%AB_10.15.55.png
s3-us-west-2.amazonaws.com
◦
op
6-bits
◦
rs
5-bits
◦
우리가 접근하고자 하는 레지스터 번호의 첫번째 번호
(first source operand)
◦
rt
5-bits
◦
두번째 번호 (second source operand)
◦
rd
5-bits (destination)
◦
결과의 목적지가 있는 레지스터
◦
shamt
(shift amount) 5-bits
◦
→ 몇 칸을 shift 할 지를 명령할 수 있음
◦
funct
6-bits
▪
op
6bit와
funct
6bit를 합쳐 어떤 연산인지 알 수 있다
add
•
R format instruction
•
add rd, rs, rt
•
→ R format 명령어 (레지스터들을 3개 필요로 하는 포맷이라서)
•
https://s3-us-west-2.amazonaws.com/secure.notion-static.com/e40b519d-8cb4-468d-9394-91a336fa6e7e/%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA_2023-03-09_%E1%84%8B%E1%85%A9%E1%84%8C%E1%85%A5%E1%86%AB_11.56.32.png
s3-us-west-2.amazonaws.com
•
in CPU
◦
rs는 src1
◦
rs2는 src2 …
◦
→ R17, 18이 ALU의 입력으로 들어감
sub
•
R format instruction
•
sub rd, rs, rt
•
https://s3-us-west-2.amazonaws.com/secure.notion-static.com/230b9370-becc-474f-826c-90cf57376823/Screenshot_2023-04-18_at_11.14.38_AM.png
s3-us-west-2.amazonaws.com
Made with SlashPage