CCPS310 – COMPUTER ORGANIZATION II

Posted helpyourjava

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CCPS310 – COMPUTER ORGANIZATION II相关的知识,希望对你有一定的参考价值。


CCPS310 – COMPUTER ORGANIZATION II
LAB 2 (7%)
ARC MEMORY MAPPED I/O
Submission instruction:
Students work in groups of 2, and are expected to do the lab together. If you
are doing in group of 2- only have one member submit the lab
Due: March 23 @23:00
Doing I/O using ARC Memory Mapped I/O
ARC does not have any explicit I/O instructions. I/O is then done by reading from and
writing to pre-defined memory locations in the memory which are assigned to I/O
devices. This is known as memory mapped I/O. Each I/O device has a data port.
Similarly, each device has a status port that is used to test the readiness status of the
I/O device.
For the purpose of this lab, we are interested in using the ARC simulator to use:
- The console output port to display characters
- The keyboard input port to read characters
1) Please provide comments for all instructions.
2) What is the memory mapped address for the console output and keyboard input?
3) Please identify the specific line of code that prints to console and reads the
keystroke.
PART A – Output: Printing character to the display
The memory addresses associated with the console output I/O device are:
- 0xffff0000 is the console (output) data port
- 0xffff0004 is the console (output) status port where bit 7 is the ready flag (0: not
ready, 1: ready)
Printing a character is achieved by:
- Checking the ready flag to see if device is ready for printing, i.e., check if the bit 7
of the output status port is set to 1
- Storing the character to the output data port
! Prints "Hello, world!\n" in the message area.
.begin
2
BASE .equ 0x3fffc0 !Starting point of the memory mapped region
COUT .equ 0x0 !0xffff0000 Console Data Port
COSTAT .equ 0x4 !0xffff0004 Console Status Port
.org 2048
add %r0, %r0, %r2
add %r0, %r0, %r4
sethi BASE, %r4
Loop: ld [%r2 + String], %r3 !Load next char into r3
addcc %r3,%r0,%r3
be End ! stop if null
Wait: ldub [%r4+COSTAT], %r1
andcc %r1, 0x80, %r1
be Wait
stb %r3, [%r4+COUT] !Print to console
add %r2, 4, %r2 !increment String offset (r2)
ba Loop
End: halt !A non-standard instruction to stop the simulator
.org 3000
! The "Hellow, world!" string
String: 0x48, 0x65, 0x6c, 0x6c, 0x6f
0x2c, 0x20, 0x77, 0x6f, 0x72
0x6c, 0x64, 0x21, 0x0a, 0
.end
PART B – INPUT: Accepting character from the keyboard
The memory addresses associated with the keyboard input I/O device are:
- 0xffff0008 is keyboard (input) data port
- 0xffff000C is the keyboard (input) status port where bit 7 is the ready flag (0: not
ready, 1: ready)
Reading a character is achieved by:
- checking the ready flag to see if the keyboard is ready, i.e., check if the bit 7 is
set to 1
- loading the character from the keyboard data port
! Read a character from keyboard
.begin
BASE .equ 0x3fffc0 !Starting point of the memory mapped region
COUT .equ 0x0 !0xffff0000 Console Data Port
COSTAT .equ 0x4 !0xffff0004 Console Status Port.
CIN .equ 0x8 !0xffff0008 Keyboard Data Port
CICTL .equ 0xc !0xffff000c Keyboard Control Port
3
.org 2048
add %r0, %r0, %r4 !Clear r4
sethi BASE, %r4
InWait: halt
ldub [%r4 + CICTL], %r1
andcc %r1, 0x80, %r1
be InWait
ldub [%r4 + CIN], %r3
subcc %r3, 27, %r5 ! 27 is Escape
be End ! stop if it is.
Wait: ldub [%r4 + COSTAT], %r1
andcc %r1, 0x80, %r1
be Wait
stb %r3, [%r4 + COUT]
ba InWait
End: halt
.end
**Note: To enter keystrokes in ArcTool Simulator,
- Click on the Console (located at the bottom of the window)
- Enter Keystroke on your keyboard.
- Re-click Run Button

因为专业,所以值得信赖。如有需要,请加QQ99515681 或邮箱:[email protected] 

微信:codinghelp

以上是关于CCPS310 – COMPUTER ORGANIZATION II的主要内容,如果未能解决你的问题,请参考以下文章

英语作文The computer

视频|BMW GS310穿越性能测试

Computer architecture Computer organization

[OpenAirInterface实战-18] :OAI 软件无线电USRP B200/B210/X300/X310/N300/N310/E310比较

jOOQ - 支持 JSR310

The future computer英语作文 急求! 初一水平的,谢谢