Skip to content

mingyu-00/Computer-Architecture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

27 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Computer architecture projects

Index

  • project1-Simple Calculator

project1-Simple Calculator

Description

๋ณธ ํ”„๋กœ์ ํŠธ๋Š” ํฐ ๋…ธ์ด๋งŒ ๊ตฌ์กฐ์™€ ISA(Instruction Set Architecture)์„ ํ™œ์šฉํ•˜์—ฌ ๊ฐ„๋‹จํ•œ ์‚ฌ์น™ ์—ฐ์‚ฐ๊ณผ MIPS CPU์•ˆ์— ์žˆ๋Š” instruction์ค‘ Move, Compare, Jump, Branch ๋“ฑ์„ ์ง์ ‘ ๊ตฌํ˜„ํ•˜๊ณ  ์ถœ๋ ฅํ•˜์—ฌ ๋ณ€์ˆ˜(๋ ˆ์ง€์Šคํ„ฐ)์˜ ์ƒํƒœ ๋ณ€ํ™”๋ฅผ ๋ณผ ์ˆ˜ ์žˆ๋Š” ํ”„๋กœ๊ทธ๋žจ์ด๋‹ค. ๋˜ํ•œ gcd.txtํŒŒ์ผ์— ์•ž์„œ ์„ ์–ธํ•œ instruction set์„ ์ด์šฉํ•˜์—ฌ ๋‘ ์ˆ˜์˜ ์ตœ๋Œ€๊ณต์•ฝ์ˆ˜๋ฅผ ๊ตฌํ• ์ˆ˜ ์žˆ๋„๋ก ํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ–ˆ๋‹ค.

Requirements for programming

  • Instruction set์€ .txtํŒŒ์ผ ์•ˆ์— ๋“ค์–ด์žˆ๊ณ  opcode operand1 operand2์˜ ๊ตฌ์กฐ๋ฅผ ๋ˆ๋‹ค(e.g : + 0x2 0x4 , M R0 0x1).
  • ๊ฐ๊ฐ์˜ Instruction๋“ค์€ ๊ฐœํ–‰์œผ๋กœ ๊ตฌ๋ถ„๋œ๋‹ค.
  • instruction set์ด .txtํŒŒ์ผ ์•ˆ์— ๋“ค์–ด๊ฐ€ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ํŒŒ์ผ์„ ์ฝ์–ด์˜ค๋Š” fopen, fgets์™€ ๊ฐ™์€ ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.
  • operand์— 16์ง„์ˆ˜ ํ˜•ํƒœ์˜ ๋ฌธ์ž์—ด๋กœ ๋“ค์–ด์˜ค๊ธฐ ๋•Œ๋ฌธ์—, ์ด๋ฅผ long type์œผ๋กœ ๋ฐ”๊ฟ”์ฃผ๋Š” strtolํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.

Instructions

  • Move(M) : ํ•ด๋‹น ๋ ˆ์ง€์Šคํ„ฐ(๋ณ€์ˆ˜)์— ๊ฐ’์„ ๋Œ€์ž…ํ•˜๋Š” instruction์ด๋‹ค. (e.g : M R0 0x1 -> R0 = 1)
  • Compare(C) : operand1 ๊ณผ operand2์˜ ๊ฐ’์„ ๋น„๊ตํ•˜์—ฌ operand1์˜ ๊ฐ’์ด ํฌ๊ฑฐ๋‚˜ ๊ฐ™๋‹ค๋ฉด R0๋ ˆ์ง€์Šคํ„ฐ์— 1์„, ์•„๋‹ˆ๋ผ๋ฉด 0์„ ๋Œ€์ž…ํ•œ๋‹ค. (e.g : C 0xa 0xc -> R0 = 0)
  • Jump(J) : operand1์— ์“ฐ์—ฌ์žˆ๋Š” ์ฃผ์†Œ๋กœ ๋„˜์–ด๊ฐ„๋‹ค. (e.g : J 0x2 -> .txtํŒŒ์ผ์˜ 2๋ฒˆ์งธ ์ค„๋กœ ์ด๋™)
  • Branch(B) : R0๋ ˆ์ง€์Šคํ„ฐ์˜ ์ƒํƒœ๊ฐ€ 1์ด๋ผ๋ฉด operand1์— ์“ฐ์—ฌ์žˆ๋Š” ์ฃผ์†Œ๋กœ Jumpํ•œ๋‹ค. (e.g : M R0 0x1, B 0x7 -> .txtํŒŒ์ผ์˜ 7๋ฒˆ์งธ ์ค„๋กœ ์ด๋™)
  • gcd : ์ตœ๋Œ€๊ณต์•ฝ์ˆ˜๋ฅผ ๊ณ„์‚ฐํ•˜๊ธฐ ์œ„ํ•œ ์ค€๋น„๋ฅผ ํ•œ๋‹ค. operand1๊ณผ operand2์— ์žˆ๋Š” ๊ฐ’์„ R1, R2๋ ˆ์ง€์Šคํ„ฐ์— ์ €์žฅํ•œ๋‹ค. (e.g : gcd 0x9 0x3 -> R1 = 9, R2 = 3)
  • Same(S) : GCD๊ณ„์‚ฐ์„ ์œ„ํ•ด ๋งŒ๋“  instruction์œผ๋กœ operand1, operand2์˜ ๊ฐ’์ด ๊ฐ™๋‹ค๋ฉด R0๋ ˆ์ง€์Šคํ„ฐ์— 1์„, ๊ฐ™์ง€ ์•Š๋‹ค๋ฉด 0์„ ๋Œ€์ž…ํ•œ๋‹ค. (e.g : S 0x4 0x4 -> R0 = 1)
  • Halt(H) : ํ”„๋กœ๊ทธ๋žจ์„ ์ข…๋ฃŒํ•œ๋‹ค. (e.g : H -> ํ”„๋กœ๊ทธ๋žจ ์ข…๋ฃŒ)

Enviroment

  • ๊ฐœ๋ฐœํ™˜๊ฒฝ : windows
  • ์‚ฌ์šฉ ์–ธ์–ด : C

project2. Single_Cycle_MIPS

About

computer architecture projects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors