안녕하세요 혹시 mips사용하시는 분들 계신가요?

chaekyo의 이미지

안녕하세요. 다름이 아니라 MIPS를 David A.Patterson, John L.henness의 Computer Organization&Design이 책으로 공부하는 중인데요. CD에 있는 project중에

Write a subroutine, wait, that will wait until the button K2 is pressed, then wait until the button is released, and finally, return. It should read from the address 0xbfa00000 until it receives a 1 in bit position 0 from this read operation. Next, it should read until the bit becomes zero again, and then return. This method of receiving 2 information from the outer world is called polling. The subroutine should be called with the instruction jal wait, as shown in the main program above.

#include

.set noreorder
.text
.globl start
.ent start

start : jal wait # Wait for button click
nop
lui s0, 0xbf90 # Load switch port address
lb s1, 0x0(s0) # Read first number from switches
nop
jal wait # Wait for button click
nop
lb s2, 0x0(s0) # Read second number from switches
nop
addu s3, s1, s2 # Perform an arithmetic operation
sb s3, 0x0(s0) # Write the result to LEDs
jal finish
nop

b start

nop

wait :(여기 빈칸의 인스트럭션을 채워야 하는데요...)

finish : lui t2, 0xbfa0

lb t3, 0x0(t2)

nop

sb t3, 0x0(t2)

nop

bnez t3, k3

nop

b finish

nop

k3 : lui t2. 0xbfa0

lb t3, 0x0(t2)

nop

sb t3, 0x0(t2)

nop

bnez t3, k3

nop

jr ra


.end start

이 문제를 어떻게 풀어야할지 도저히 모르겠어서 도움을 요청해 봅니다:)


jachin의 이미지

문제라고 말씀하신 wait 서브루틴은 다음의 설명을 수행하도록 만들어야 하겠죠?

chaekyo wrote:
It should read from the address 0xbfa00000 until it receives a 1 in bit position 0 from this read operation. Next, it should read until the bit becomes zero again, and then return. This method of receiving 2 information from the outer world is called polling.

0xbfa00000 번지의 값이 1이 되었다가 0이 되었을 때, K2 스위치가 눌렸다가 떼였다는 것을 감지할 수 있을 것입니다. finish 루틴을 보시면 어느 정도 이해하실 수 있으리라 생각합니다. 저도 그 책을 읽고 MIPS 구현을 해봤습니다만, 오랫만의 AT&T 어셈블러 문법이라 조금 아리송 하네요.
크게 어려운 문제는 아니니 이해하시리라 생각합니다.
====
하나는 전부, 전부는 하나
chaekyo의 이미지

k2가 실행스위치이고 k1이 리셋스위치인것은 알겠는데 도통 저 사이에 어떤 인스트럭션을 넣어야 하는지 모르겠어서요ㅜ

익명 사용자의 이미지

면 어느 정도 이해하실 수음 "설정 저장"음 "설정 저장"을 누을 누 있으리라 생각합니다. 저도 그 책음 "설정 저장"을 누을 읽고음 "설정 저장"을 누 MIPS 구현을 해봤습니다만, 오랫만의 AT&T 음 "설정 저장"을 누

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.