Computer Architecture/컴퓨터구조[05]23 [CA] Lecture #26 (1) Block Replacement Policy ▶ LRU (Least-Recently Used) Direct mapped cache: Set 하나 당 엔트리가 1개이다. 따라서 선택지는 하나뿐이다. 2-way associative cache: Set 하나 당 엔트리가 2개이다. 따라서 가장 덜 최근에 사용된 것을 지우고, 그 자리에 필요한 데이터를 쓴다. --> timestamp를 위한 bit: 1-bit (2^1 = 2) Fully associative cache(= 4-way associative cache): Set 하나 당 엔트리가 4개이다. 따라서 가장 덜 최근에 사용된 것을 지우고, 그 자리에 필요한 데이터를 쓴다. --> timestamp를 위한 bit: 2-bit (2^2 = 4) - 장점:.. 2023. 12. 1. [CA] Lecture #25 Example: Intrinsity FastMATH Large cache: 1 block = 64 bytes Large cache의 경우, block의 크기는 크지만, 이를 다시 CPU로 보낼 때는 1 word(= 4 bytes) 단위로 보내야 한다. 따라서 64 bytes를 4 bytes씩 16개로 쪼개놓는 것이다. Main Memory Supporting Caches ▷ 1 block = 4 word의 경우 miss penalty: 1: address transfer 4*15: DRAM access (DRAM은 1 word씩만 접근 가능하기 때문에 4를 곱해야 한다.) 4*1: data transfer (DRAM은 1 word씩만 접근 가능하기 때문에 4를 곱해야 한다. Designing the Me.. 2023. 11. 28. [CA] Lecture #24 Cache Example Index: 몇 번째 cache block인지 결정한다. (마지막 3-bit) V: 해당 cache block에 데이터가 있는지 표시한다. Tag: 해당 cache block에 있는, 어떤 데이터인지 구분한다. (전체 주소 = Tag_Index) Data: 메모리의 (Tag_Index) 주소에서 가져온 1 word(4 bytes) 데이터 Address Subdivision Index (10 bits): "몇 번째 cache block인가?" Valid (1 bit): "이 cache block 안에는 데이터가 들어있는가?" Tag (20 bits): "이 cache block 안에는 정확히 어떤 데이터가 들어있는가?" Data (32 bits = 4 bytes = 1 word) .. 2023. 11. 23. [CA] Lecture #23 - Ch5: Large and Fast: Exploiting Memory Hierarchy Ch5: Large and Fast: Exploiting Memory Hierarchy Memory Hierarchy --> Processor에 가까워질수록 작아지고, 빨라진다. Principle of Locality Temporal locality: Items accessed recently are likely to be accessed again soon. (예: instructions in a Loop) Spatial locality: Items near those accessed recently are likely to be accessed soon. (예: sequential instructions) --> Cache에는 Locality가 있는 데이터를 저장한다. Memory Hierarchy .. 2023. 11. 21. 파이프라이닝(Pipelining)과 비순차적 명령어 처리(Out-of-order execution) 컴퓨터구조 수업시간에 교수님께서 파이프라이닝으로 인한 hazard 문제와 그 해결책들에 대해 설명해 주시면서 out-of-order core 이야기를 하셨는데요,,, 관심이 있으면 찾아보라고 하셔서 한번 찾아보았습니당. 세상에는 알아가야 될 게 정말 많네요... ㅎㅎ 비순차적 명령어 처리(out-of-order execution) 비순차적 명령어 코어(out-of-order core) 먼저, 비순차적 명령어 처리에 대해 이해하기 위해서는 컴퓨터의 CPU에서 명령어들을 처리하는 과정에 대한 이해가 필요하다. 간단하게 요약하면: 컴퓨터는 명령어를 처리한다. 그리고 이 명령어들을 좀 더 빠르게 처리하기 위해 어떤 기법(파이프라이닝; pipelining)을 이용한다. 그런데 이 기법을 이용하면, 명령어들 간의 .. 2023. 11. 20. [CA] Lecture #22 Control Hazard : beq에서 branch 여부는 원칙적으로 EX 단계가 끝나고, MEM 단계에서 알 수 있다. --> beq instruction 다음에 어떤 연산을 수행해야 할 지, 따라서 어떤 PC 값을 설정해야 할 지( PC+4 또는 PC+offset)를 알기 위해서는 3 STALL이 발생한다. ▶ beq: PC-relative branch MIPS: PC = (PC+4) + (immediate * 4) Reducing Branch Delay: Register Compactor ▶ Register Compactor : ID 단계의 Register file에서 beq에서 비교 연산에 사용되는 레지스터 값을 읽고, 그 결과를 IF 단계의 MUX에 전달하여, (PC + 4) 또는 (PC + .. 2023. 11. 17. [CA] Lecture #21 Hazards Data Hazards : Register file에서 서로 다른 instruction에 대한 WB과 ID가 동시에 일어나기 때문에 발생하는 hazard. In the Pipeline EX hazard MEM hazard Cf) 세 번째 WB, ID는 같은 time에 일어나도 괜찮다! : ID에서 wirte 먼저, read 나중에 일어나기 때문이다. Solution: Forwarding EX hazard, MEM hazard --> forwarding! 세 번째는 forwarding 할 필요 없다. Data Hazard Detection EX hazard (ver.1) : EX/MEM pipeline register에 저장된 destination register = ID/EX pipelin.. 2023. 11. 15. [CA] Lecture #20 A Pipelined Datapath ▶ Five Stages: IF: Instruction fetch. ID: Instruction decode & register file read. EX: Execution or address calculation. MEM: Data memory access. WB: Write back. Single-Cycle Datapath Control Hazard: branch 여부에 따라 PC값이 달라진다. - Branch (x) --> PC+4 - Branch (o) --> (PC+4) + offset Data Hazard: Register file에서 서로 다른 instruction에 대한 WB과 ID가 동시에 일어나기 때문에 발생한다. Pipeline Registers .. 2023. 11. 14. [CA] Lecture #19 Steps in Executing RISC-V IF: Instruction fetch from memory. ID: Instruction decode & register read. (어떤 instruction인지, register 값) EX: Execute operation (R-format), calculate address (lw, sw). MEM: Access memory operand. WB: Write result back to register. Pipeline Performance Ideal Speedup : instruction의 단계를 동일한 시간으로 나눌 수 없기 때문에, 단계의 수 만큼 speed up 할 수는 없다. Pipelined Execution Representation Rev.. 2023. 11. 9. 이전 1 2 3 다음