kiến trúc máy tính nguyễn thanh sơn chương4 bo xử lý sinhvienzone com

128 58 0
kiến trúc máy tính nguyễn thanh sơn chương4 bo xử lý sinhvienzone com

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Computer Architecture Computer Science & Engineering Chương Bộ Xử lý BK TP.HCM CuuDuongThanCong.com https://fb.com/tailieudientucntt Dẫn nhập  Các yếu tố xác định hiệu xuất Bộ Xử lý  Số lệnh (Instruction Count)   Số chu kỳ cho lệnh thời gian chu kỳ đ/hồ    Phiên đơn giản Phiên thực (cơ chế đường ống) Nhóm lệnh đơn giản, đặc trưng:    BK Xác định phần cứng CPU Đề cập mơ hình thực MIPS   Xác định “Kiến trúc tập lệnh” ISA Trình biên dịch Truy cập nhớ: lw, sw Số học/luận lý: add, sub, and, or, slt Nhảy, rẽ nhánh (chuyển điều khiển): beq, j TP.HCM 4/5/2019 CuuDuongThanCong.com Khoa Khoa học & Kỹ thuật Máy tính https://fb.com/tailieudientucntt Các bước thực lệnh    PC Bộ nhớ chứa lệnh, Nạp lệnh Đọc nội dung ghi (Register numbers[rs, rt, rd] register file) Tùy thuộc vào loại lệnh mà  Sử dụng ALU để tính      Phép số học  Kết Xác định địa nhớ (load/store) Xác định địa rẽ nhánh Truy cập liệu nhớ cho lệnh for load/store PC Địa lệnh kế or PC + BK TP.HCM 4/5/2019 CuuDuongThanCong.com Khoa Khoa học & Kỹ thuật Máy tính https://fb.com/tailieudientucntt Lược đồ thực (CPU) BK TP.HCM 4/5/2019 CuuDuongThanCong.com Khoa Khoa học & Kỹ thuật Máy tính https://fb.com/tailieudientucntt Bộ Multiplexer  Không thể nối dây trực tiếp lại với  Sử dụng multiplexers BK TP.HCM 4/5/2019 CuuDuongThanCong.com Khoa Khoa học & Kỹ thuật Máy tính https://fb.com/tailieudientucntt Bộ phận Điều khiển BK TP.HCM 4/5/2019 CuuDuongThanCong.com Khoa Khoa học & Kỹ thuật Máy tính https://fb.com/tailieudientucntt Nguyên lý thiết kế luận lý  Biểu diễn thông tin nhị phân     Phần tử tổ hợp    Áp mức thấp = 0, Áp mức cao = Một đường dây cho bit Dữ liệu gồm nhiều bit biểu diễn tuyến nhiều đường dây Thực liệu Kết đầu = hàm(đầu vào) Phần tử trạng tái (mạch tuần tự)  Lưu liệu BK TP.HCM 4/5/2019 CuuDuongThanCong.com Khoa Khoa học & Kỹ thuật Máy tính https://fb.com/tailieudientucntt Ví dụ: phần tử tổ hợp BK TP.HCM 4/5/2019 CuuDuongThanCong.com Khoa Khoa học & Kỹ thuật Máy tính https://fb.com/tailieudientucntt Phần tử  Thanh ghi: lưu liệu mạch   Sử dụng tín hiệu xung đồng hồ để xác định cập nhật giá trị lưu trữ Kích cạnh: đầu cập nhật xung đồng hồ thay đổi từ lên D Q Clk D Clk Q BK TP.HCM 4/5/2019 CuuDuongThanCong.com Khoa Khoa học & Kỹ thuật Máy tính https://fb.com/tailieudientucntt Phần tử (tt.)  Thanh ghi với tín hiệu đ/khiển write   Chỉ cập nhật theo cạnh xung mức điều khiển write mức Sử dụng trường hợp lưu cho chu kỳ sau Clk D Q Write Clk Write D Q BK TP.HCM 4/5/2019 CuuDuongThanCong.com Khoa Khoa học & Kỹ thuật Máy tính https://fb.com/tailieudientucntt 10 MIPS with Static Dual Issue  Two-issue packets    One ALU/branch instruction One load/store instruction 64-bit aligned   ALU/branch, then load/store Pad an unused instruction with nop Address Instruction type Pipeline Stages n ALU/branch IF ID EX MEM WB n+4 Load/store IF ID EX MEM WB n+8 ALU/branch IF ID EX MEM WB n + 12 Load/store IF ID EX MEM WB n + 16 ALU/branch IF ID EX MEM WB n + 20 Load/store IF ID EX MEM WB BK TP.HCM 4/5/2019 CuuDuongThanCong.com Faculty of Computer Science & Engineering https://fb.com/tailieudientucntt 114 MIPS with Static Dual Issue BK TP.HCM 4/5/2019 CuuDuongThanCong.com Faculty of Computer Science & Engineering https://fb.com/tailieudientucntt 115 Hazards in the Dual-Issue MIPS   More instructions executing in parallel EX data hazard   Forwarding avoided stalls with single-issue Now can’t use ALU result in load/store in same packet    Load-use hazard   add $t0, $s0, $s1 load $s2, 0($t0) Split into two packets, effectively a stall Still one cycle use latency, but now two instructions More aggressive scheduling required BK TP.HCM 4/5/2019 CuuDuongThanCong.com Faculty of Computer Science & Engineering https://fb.com/tailieudientucntt 116 Scheduling Example  Schedule this for dual-issue MIPS Loop: lw addu sw addi bne Loop:  BK $t0, $t0, $t0, $s1, $s1, 0($s1) $t0, $s2 0($s1) $s1,–4 $zero, Loop # # # # # $t0=array element add scalar in $s2 store result decrement pointer branch $s1!=0 ALU/branch Load/store cycle nop lw addi $s1, $s1,–4 nop addu $t0, $t0, $s2 nop bne sw $s1, $zero, Loop $t0, 0($s1) $t0, 4($s1) IPC = 5/4 = 1.25 (c.f peak IPC = 2) TP.HCM 4/5/2019 CuuDuongThanCong.com Faculty of Computer Science & Engineering https://fb.com/tailieudientucntt 117 Loop Unrolling  Replicate loop body to expose more parallelism   Reduces loop-control overhead Use different registers per replication   Called “register renaming” Avoid loop-carried “anti-dependencies”   Store followed by a load of the same register Aka “name dependence”  Reuse of a register name BK TP.HCM 4/5/2019 CuuDuongThanCong.com Faculty of Computer Science & Engineering https://fb.com/tailieudientucntt 118 Loop Unrolling Example  IPC = 14/8 = 1.75  Closer to 2, but at cost of registers and code size BK TP.HCM 4/5/2019 CuuDuongThanCong.com Faculty of Computer Science & Engineering https://fb.com/tailieudientucntt 119 Dynamic Multiple Issue   “Superscalar” processors CPU decides whether to issue 0, 1, 2, … each cycle   Avoiding structural and data hazards Avoids the need for compiler scheduling   Though it may still help Code semantics ensured by the CPU BK TP.HCM 4/5/2019 CuuDuongThanCong.com Faculty of Computer Science & Engineering https://fb.com/tailieudientucntt 120 Dynamic Pipeline Scheduling  Allow the CPU to execute instructions out of order to avoid stalls   But commit result to registers in order Example  lw $t0, addu $t1, sub $s4, slti $t5, Can start sub 20($s2) $t0, $t2 $s4, $t3 $s4, 20 while addu is waiting for lw BK TP.HCM 4/5/2019 CuuDuongThanCong.com Faculty of Computer Science & Engineering https://fb.com/tailieudientucntt 121 Dynamically Scheduled CPU Preserves dependencies Hold pending operands Results also sent to any waiting reservation stations Reorders buffer for register writes Can supply operands for issued instructions BK TP.HCM 4/5/2019 CuuDuongThanCong.com Faculty of Computer Science & Engineering https://fb.com/tailieudientucntt 122 Register Renaming   Reservation stations and reorder buffer effectively provide register renaming On instruction issue to reservation station  If operand is available in register file or reorder buffer    If operand is not yet available  BK Copied to reservation station No longer required in the register; can be overwritten  It will be provided to the reservation station by a function unit Register update may not be required TP.HCM 4/5/2019 CuuDuongThanCong.com Faculty of Computer Science & Engineering https://fb.com/tailieudientucntt 123 Speculation  Predict branch and continue issuing   Don’t commit until branch outcome determined Load speculation  Avoid load and cache miss delay      BK Predict the effective address Predict loaded value Load before completing outstanding stores Bypass stored values to load unit Don’t commit load until speculation cleared TP.HCM 4/5/2019 CuuDuongThanCong.com Faculty of Computer Science & Engineering https://fb.com/tailieudientucntt 124 Why Do Dynamic Scheduling?   Why not just let the compiler schedule code? Not all stalls are predicable   Can’t always schedule around branches   e.g., cache misses Branch outcome is dynamically determined Different implementations of an ISA have different latencies and hazards BK TP.HCM 4/5/2019 CuuDuongThanCong.com Faculty of Computer Science & Engineering https://fb.com/tailieudientucntt 125 Does Multiple Issue Work?    Yes, but not as much as we’d like Programs have real dependencies that limit ILP Some dependencies are hard to eliminate   Some parallelism is hard to expose    Limited window size during instruction issue Memory delays and limited bandwidth  BK e.g., pointer aliasing Hard to keep pipelines full Speculation can help if done well TP.HCM 4/5/2019 CuuDuongThanCong.com Faculty of Computer Science & Engineering https://fb.com/tailieudientucntt 126 Tiết kiệm lượng   Complexity of dynamic scheduling and speculations requires power Multiple simpler cores may be better Microprocessor Year Clock Rate Pipeline Stages Issue width Out-of-order/ Speculation Cores Power i486 1989 25MHz No 5W Pentium 1993 66MHz No 10W Pentium Pro 1997 200MHz 10 Yes 29W P4 Willamette 2001 2000MHz 22 Yes 75W P4 Prescott 2004 3600MHz 31 Yes 103W Core 2006 2930MHz 14 Yes 75W UltraSparc III 2003 1950MHz 14 No 90W UltraSparc T1 2005 1200MHz No 70W BK TP.HCM 4/5/2019 CuuDuongThanCong.com Khoa Khoa học & Kỹ thuật Máy tính https://fb.com/tailieudientucntt 127 Tổng kết    ISA influences design of datapath and control Datapath and control influence design of ISA Pipelining improves instruction throughput using parallelism     Rủi ro: cấu trúc, liệu, điều khiển Multiple issue and dynamic scheduling (ILP)  BK More instructions completed per second Latency for each instruction not reduced  Dependencies limit achievable parallelism Complexity leads to the power wall TP.HCM 4/5/2019 CuuDuongThanCong.com Khoa Khoa học & Kỹ thuật Máy tính https://fb.com/tailieudientucntt 128 ... 4/5/2019 CuuDuongThanCong .com Khoa Khoa học & Kỹ thuật Máy tính https://fb .com/ tailieudientucntt 11 Xây dựng lộ trình xử lý  Lộ trình xử lýDatapath  Các phần tử chức xử lý liệu địa CPU   Registers,... CuuDuongThanCong .com Khoa Khoa học & Kỹ thuật Máy tính https://fb .com/ tailieudientucntt Ví dụ: phần tử tổ hợp BK TP.HCM 4/5/2019 CuuDuongThanCong .com Khoa Khoa học & Kỹ thuật Máy tính https://fb .com/ tailieudientucntt... CuuDuongThanCong .com Khoa Khoa học & Kỹ thuật Máy tính https://fb .com/ tailieudientucntt Bộ phận Điều khiển BK TP.HCM 4/5/2019 CuuDuongThanCong .com Khoa Khoa học & Kỹ thuật Máy tính https://fb .com/ tailieudientucntt

Ngày đăng: 28/01/2020, 23:05

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan