본문 바로가기

전공

컴퓨터 구조

Chapter 1

 

personal computer

개인적인 용도로 비용/성능 잘 조율해야 함

 

server computer

용량, 성능 높음, range 범위 상관 x

 

embedded computer

구성요소를 hidden, 파워, 성능, 비용적인 제약

 

personal mobile device(PMD)

모바일로 연산에 한계가 있음 → cloud computing으로 보완

 

application software: high level language → 생산성과 portability 높음

→ system software: compiler

→ assembly (MIPs)

 

hardware: processor, memory → hardware 따라 해석방식 다름

모든 종류의 CPU의 구성요소는 거의 유사

 

Chapter 2

 

Different computers have different instruction sets. 하지만 많은 측면에서 in common

예전 컴퓨터, 요즘 컴퓨터 모두 심플한 명령어 set을 가졌음

Registers are faster than memory

MIps ↔ C 변환 중요

op rs rt rd shamt funct 값 전다 후 r-format 비트 패턴 생성

 

Chapter 3

 

1.f는 float형의 숫자 1을 나타내는데, float형은 소수점 이하의 숫자를 근사값으로 저장하기 때문에 정확한 계산 결과를 보장하지 않습니다. 따라서 1.f의 100만, 천만, 1억, 10억 회를 더한 결과를 정확하게 예상하는 것은 불가능합니다.

 

하지만, float형의 경우 값이 점차 커지면서 overflow 현상이 발생할 수 있습니다. 이 경우 최댓값을 넘어가면서 값을 정확히 나타내지 못하고 inf (무한대)로 표시될 수 있습니다. 따라서 1.f에 큰 값을 더하다 보면, 특정 시점에서 inf가 나타날 가능성이 높습니다.

 

그리고 float형에서는 작은 값을 더하면서 값이 점점 줄어들다가, 일정 수준 이하로 작아지면 0으로 표시될 수 있습니다. 따라서 1.f에 작은 값을 반복적으로 더하면서 값이 0으로 수렴하는 것도 가능합니다.

결론적으로, float형에서는 값이 커지면 overflow 현상이 발생할 가능성이 있고, 작아지면 0으로 수렴할 가능성이 있으며, 정확한 예측이 불가능합니다.

 

Chapter 4

https://ydeer.tistory.com/143

 

컴퓨터 구조 및 설계 - Chapter 4. The Processor

Chapter 4. The ProcessorㆍProcessor의 내부 구조를 이해할 수 있다.4.1 - Introduction4.2 - Logic Design Conventions4.3 - Building a Datapath4.4 - A Simple Implementation Scheme4.5 - An Overview of Pipelining4.6 - Pipelined Datapath and Control4.

ydeer.tistory.com

 

CPU 전체적인 흐름

 

멀티 플렉서

명령어 → fetch, r-format, load/store, branch

 

datapath → r-type,load/store, full

Exception

Hazards → forwarding, load-use, branch, stall

ALU → control..

Pipline → register - IF, ID, EX, MEM, WB

add s0 s1 s2

PC(명령어 주소) → instruction memory(주소 읽고 출력)→ register file → ALU → data memory → register file

branch - beq

 

register write control

data를 원할 때 저장하기 위함. input 1이면 동작

 

longest delay를 기준으로 clock period 정함 → critical path(가장 오래 걸리는 경로): load instruction

piplining을 통해서 성능을 개선한다.

 

Data path: data와 address in CPU- register, ALU, mux, memory

 

PC를 4씩 더해주면서, 다음 명령으로 넘어간다, 워드(Word)는 4 Byte 단위이기 때문

 

instruction은 one clock cycle에 이루어짐

 

datapath 요소들은 한번에 one function at a time

 

각각 다른 명령마다 다른 입력 데이터(data sources)를 받는 경우엔 멀티플렉서를 쓴다.

 

ADD는 PC를 다음 명령어 주소로 증가시키는 덧셈기, 두개의 입력을 받는데 하나는 PC, 다른 하나는 32비트 상수 4로 고정 - 출력은 항상 PC + 4

 

MIPs Pipline: IF - ID -EX - MEM - WB

 

Hazard

이전의 명령어를 read/write 하기위해 wait, control - 이전의 명령어를 통해 움직임, structure

 

 

Chapter 5

 

Principle of Locality

Temporal locality: 반복 loop

Spatial locality: 근처에 접근 array

 

Advantage of Locality

main memory: 더 작은 DRAM memory에서 recently accessed Copy

Cache memory: DRAM → SRAM

Hit: upper level로 access

 

Memory Technology

SRAM: 빠름, 비쌈 DRAM: 느림, 저렴 Magnetic disk: 더 느림, 더 저렴

→ SRAM으로 빠르게 하고 Magnetic disk의 용량을 사용하여 저렴하게 한다.

Double data rate (DDR) DRAM: Transfer on rising and falling clock edges

DRAM banking: Allows simultaneous access to multiple DRAMs

Flash Storage: Nonvolatile semiconductor storage, disk보다 빠르고 작고 저전력, 비쌈

Disk Storage: track, cylinder, sector로 구성

 

Flash Types: NOR flash, NAND flash

단점: direct RAM or disk replacement에 적합하지 않다.

one-word-wide memory

 

Cache

Disk drives include caches → Avoid seek and rotational delay

Cache memory: 속도 빠름, 비쌈 → 일부만 사용

Direct Mapped Cache: Direct mapped only one choice = one-way set associative

memory에서 Use low order address bits 3개가 같은 cache와 연결

What if there is no data in a location? Valid bit: 1 = present, 0 = not present

Block Size Considerations

Larger blocks - reduce miss rate

하지만 cache의 사이즈가 고정되어 있다면 blocks의 수가 줄기 때문에 오히려 miss rate가 커진다.

 

Write Policy

Write Through: update upper, lower level. replacement, 하지만 overhead 시 write buffer을 요구

Write Back: update upper level only, block이 replaced면 update lower

Direct Mapped Cache는 정해진 위치의 cache로만 들어갈 수 있다는 한계

→ Fully associative → n-way set associative

 

Replacement Policy

Direct mapped: no choice

  • Least recently used (LRU)
  • Random

Address Translation: Virtual address → page table(translation) → Physical address

page table의 valid가 1이면 이동, 0 이면 disk로 이동

Fast Translation Using a TLB: TLB에 data 정보 없으면 page table에서 physical memory에 접

Page Fault Penalty: On page fault, the page must be fetched from disk

 

datapath에서 left shift를 사용하는 작업은?

아마 piplined data path이고, EX에서 shift left 2가 실행된다.

 

Detecting the Need to Forward

  • EX/MEM.RegisterRd = ID/EX.RegisterRs
  • EX/MEM.RegisterRd = ID/EX.RegisterRt

→ 바로 이전의 stage에서 dependency가 발생한 상태이므로 EX/MEM에서 forward

  • MEM/WB.RegisterRd = ID/EX.RegisterRs
  • MEM/WB.RegisterRd = ID/EX.RegisterRt

→ 이전의 stage에서 dependency가 발생한 상태이므로 MEM/WB에서 forward

하지만 만약 Register에 Write를 하지 않는다면 아무 의미가 없다.

 

따라서 아래의 검사도 추가로 진행

  • EX/MEM.RegWrite, MEM/WB.RegWrite

만약 Rd가 0이라면 zero register에 넣는 것이므로 아무 의미가 없기 때문에 해당 조건도 검사

  • EX/MEM.RegisterRd != 0
  • MEM/WB.RegisterRd != 0

총 3개의 조건을 만족해야 비로소 Forwarding

 

Explain the condition for load use hazard in Load Use Hazard Detection.

ID/EX.MemRead and

((ID/EX.RegisterRt = IF/ID.RegisterRs) or

(ID/EX.RegisterRt = IF/ID.RegisterRt))

 

how to stall the pipeline: ID/EX register = 0

https://chayan-memorias.tistory.com/176

 

컴퓨터 구조 4-4강. 단순한 구현

[ALU 제어] : 명령어에 따라 ALU에서 수행하는 연산작업이 다른데, 그에 따른 ALU에 전달되는 제어 신호 # ALU 제어 신호의 종류 6가지 ALU 제어 신호 연산 종류 0000 AND 0001 OR 0010 add 0110 subtract 0111 set on l

chayan-memorias.tistory.com

 

'전공' 카테고리의 다른 글

인공 지능  (0) 2024.05.22
데이터 통신  (0) 2024.05.22
빅데이터  (0) 2024.05.22
컴퓨터 네트워크  (0) 2024.05.22
미래 네트워크  (0) 2024.05.22