CS/컴퓨터 구조 18

Lecture 09: Arithmetic for Computers - 1

경희대학교 김정욱 교수님의 컴퓨터 구조 수업을 기반으로 정리한 글입니다.Arithmetic Operation▶ MIPS code▶ ALU (Arithmetic and Logical Unit) ALU사칙 연산을 담당하는 하드웨어이다. (덧셈, 뺄셈, 곱셈 - 덧셈의 연속, 나눗셈 - 뺄셈의 연속)입력 2개: 연산할 레지스터 2개에 대응하는 각각의 값들Opcode: 어떤 연산을 할지 결정출력 2개: 연산 결과를 저장할 레지스터, Overflow 확인 위한 StatusAddition and Subtraction1. Addition (binary)▶ Addition▶ carry (올림수) carry: 올림수 2. Subtraction (binary)▶ Subtraction: A - B (뺄셈)▶ Subtract..

CS/컴퓨터 구조 2024.10.16

Lecture 08: Instructions - Language of the Computer - 5

경희대학교 김정욱 교수님의 컴퓨터 구조 수업을 기반으로 정리한 글입니다.Translating and Starting a ProgramTranslation hierarchy for C language (번역 계층)▶ Translation hierarchy for C language 어셈블러는 0과 1로 단순히 변환하는데,이때 파일을 obj 파일이라고 한다. (0과 1로 이루어진 파일) 그리고 이러한 obj 파일을 여러 개 연결하여 하나의 소프트웨어, 실행 가능한 exe 파일을 링커가 만들고,이렇게 만들어진 exe를 더블 클릭해서 사용자가 사용하겠다고 하면, 로더는 이 파일을 메모리 (RAM)에 올려 놓는다. 1. CompilerHigh-level language code -> assembly languag..

CS/컴퓨터 구조 2024.10.14

Lecture 07: Instructions - Language of the Computer - 4

경희대학교 김정욱 교수님의 컴퓨터 구조 수업을 기반으로 정리한 글입니다.Compilde MIPS Code ExamplesCompiling steps1. Allocate registers to program variables변수마다 레지스터를 할당한다. 2. Produce code for the body of the procedure함수의 코드를 직접 컴파일, 즉 assembly code를 작성한다. 3. Preserve registers across the procedure invocation(호출)레지스터 보존 여부, 즉 callee로 가기 전, 레지스터에 저장된 값을 메모리에 저장할지 말지를 결정한다.ex) 레지스터 보존 - $s0, $ra▶ Compiling stepsCompilde MIPS Cod..

CS/컴퓨터 구조 2024.10.14

Lecture 06: Instructions - Language of the Computer - 3

경희대학교 김정욱 교수님의 컴퓨터 구조 수업을 기반으로 정리한 글입니다.Explanation of 32 Registers32 Registers$zero: contains 0 value$a0 ~ $a3: function argument, 함수를 호출할 때 전달하는 인자$v0, $v1: return values, 최종 결과값을 전달할 때 사용$t0 ~ $t9: temporary register (do not have to preserve), 덮어쓰기 가능 (메모리에 저장 X)$s0 ~ $s7: saved registers (preserve), 덮어쓰기 불가능 (메모리에 저장)$gp: global pointer (to access static data ex) constant value)$sp: stack po..

CS/컴퓨터 구조 2024.10.08

Lecture 05: Instructions - Language of the Computer - 2

경희대학교 김정욱 교수님의 컴퓨터 구조 수업을 기반으로 정리한 글입니다.Signed and Unsigned Numbers우리는 10진법을 사용하지만 컴퓨터는 2진법을 사용한다. (0 or 1)▶ base 2 -> base 10▶ MSB - LSBLeast significant bit (LSB): The right most bit in a MIPS word (작다)Most significant bit (MSB): The left most bit in a MIPS word (크다)※ signed bit의 경우, MSB가 0이면 양수, 1이면 음수가 되기에 MSB가 중요하다.Signed and Unsigned Numbers비트만 봐서는 signed bit인지, unsigned bit인지 알 수 없고,unsig..

CS/컴퓨터 구조 2024.09.29

Lecture 04: Instructions - Language of the Computer - 1

경희대학교 김정욱 교수님의 컴퓨터 구조 수업을 기반으로 정리한 글입니다.Instruction (Introduction)▶ Compiler: high-level language -> assembly language, Assembler: assembly language -> binary machine language ※ assembler: 단순히 instruction에 대응하는 binary 조합을 dictionary를 보고 찾는 것이다. Instruction (명령어)Assembly Language Notation(표기법)으로, 컴퓨터한테 명령을 할 때 쓰는 명령어이다.이때 instrucion이 모여 있는 집합을 instruction set이라고 한다. 이렇게 컴파일된 결과를 binary로 바꿨을 때(ass..

CS/컴퓨터 구조 2024.09.28

Lecture 03: Computer Abstractions and Technology - 2

경희대학교 김정욱 교수님의 컴퓨터 구조 수업을 기반으로 정리한 글입니다.Measuring Performance컴퓨터 구조에선 speed가 performance measuring의 기준이다. ※ Comparing performances may different depending on the situation 즉, 컴파일러를 어떻게 효율적으로 잘 하고, 하드웨어 디자인을 어떻게 잘 하느냐,그래서 결국, 속도가 얼마나 빠르냐가 가장 중요하다. There are a number of measurements of performanceClock speedCPI (Clock Cycles per Instrucion)MIPS (Millions of Instructions per Second)Etc.※ 여기서 MIPS는 ..

CS/컴퓨터 구조 2024.09.26

Lecture 02: Computer Abstractions and Technology - 1

경희대학교 김정욱 교수님의 컴퓨터 구조 수업을 기반으로 정리한 글입니다.Why we Study Computer Architecture?▶  Code (e.g, Python) 컴퓨터는 binary(0 or 1)로만 이루어진 하드웨어이기 때문에 위 code와 같은 high level language는 이해하지 못 한다.때문에 컴퓨터가 이해할 수 있는 low level language로 바꿔줘야 한다. 이때, 가장 중요한 게 CPU이다.▶ Inside of Computer ※ Register: CPU 내의 소형 고속 메모리 저장 위치로, 사칙 연산 처리 등에 사용된다.Class of Computing Applications1. PC(Personal Computer)Personal의 뜻처럼, 각자 용도, 예를 ..

CS/컴퓨터 구조 2024.09.26