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

因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com

微信:codinghelp

原文地址:https://www.cnblogs.com/helpyourjava/p/10595489.html

时间: 2024-08-30 11:28:30

CCPS310 – COMPUTER ORGANIZATION II的相关文章

Computer architecture Computer organization

COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCEComputer architectureNINTH EDITION Computer architecture refers to those attributes of a system visible to aprogrammer or, put another way, those attributes that have a direct impact ont

CSCI 2121: Computer Organization Assembly Language

CSCI 2121: Computer Organization andAssembly LanguageLab 5Design Sequential Circuits in Verilog IIIFebruary 27, 20191 Learning Objectives In this lab, you will use what we have learned about sequential circuits to implement differenttypes of shift re

Pentium II paging mechanism

COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION To understand the structure of the linear address, you need to know that the Pentium II paging mechanism is actually a two-level table lookup operation. The first level is

the major advances since the birth of the computer

COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION ? The family concept: Introduced by IBM with its System/360 in 1964, followed shortly thereafter by DEC, with its PDP-8. The family concept decouples the architecture of a

the computer spends over 96% of its time waiting for I/O devices to finish transferring data

COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION

ARM与x86之3--蝶变ARM

转载于:  http://blog.sina.com.cn/s/blog_6472c4cc0100lqr8.html 1929年开始的经济大萧条,改变了世界格局.前苏联的风景独好,使得相当多的人选择了马克思.惧怕布尔什维克红色力量的人投入了法西斯的怀抱,剩余的人选择了妥协与折中.整个世界的迅速分解使得第二次世界大战成为必然. 1933年,罗斯福成为美国第三十二任总统,开始实施新政.这些新政使美国摆脱了危机,决定了二战的走向.罗斯福的背后站着的是凯恩斯,凯恩斯的国家资本主义化解了整个资本主义阵营有

The MESI Protocol

COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION To provide cache consistency on an SMP, the data cache often supports a protocol known as MESI. For MESI, the data cache includes two status bits per tag, so that each lin

Virtual Memory PAGE TABLE STRUCTURE

COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION The basic mechanism for reading a word from memory involves the translation of a virtual, or logical, address, consisting of page number and offset, into a physical addres

Virtual address cache memory, processor and multiprocessor

An embodiment provides a?virtual?address?cache?memory including: a TLB virtual?page memory configured to, when a rewrite to a TLB occurs, rewrite entry data; a data memory configured to hold?cache?data using a?virtual?page tag?or a page offset as a?c