1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Leya [2.2K]
3 years ago
14

There will be 10 numbers stored contiguously in the computer at location x 7000 . Write a complete LC-3 program, starting at loc

ation x3000, that will find the location of the smallest number and swap its location with the number in location x7000. For example, Suppose the following numbers are stored at location x7000:
Computers and Technology
2 answers:
Artist 52 [7]3 years ago
7 0

Answer:

The LC-3 (Little Computer 3) is an ISA definition for a 16-bit computer. Its architecture includes physical memory mapped I/O via a keyboard and display; TRAPs to the operating system for handling service calls; conditional branches on N, Z, and P condition codes; a subroutine call/return mechanism; a minimal set of operation instructions (ADD, AND, and NOT); and various addressing modes for loads and stores (direct, indirect, Base+offset, PC-relative, and an immediate mode for loading effective addresses). Programs written in LC-3 assembler execute out of a 65536 word memory space. All references to memory, from loading instructions to loading and storing register values, pass through the get Mem Adr() function. The hardware/software function of Project 5 is to translate virtual addresses to physical addresses in a restricted memory space. The following is the default, pass-through, MMU code for all memory references by the LC-3 simulator.

unsigned short int get Mem Adr(int va, int rwFlg)

{

unsigned short int pa;

// Warning: Use of system calls that can cause context switches may result in address translation failure

// You should only need to use gittid() once which has already been called for you below. No other syscalls

// are necessary.

TCB* tcb = get TCB();

int task RPT = tcb [gettid()].RPT;

pa = va;

// turn off virtual addressing for system RAM

if (va < 0x3000) return &memory[va];

return &memory[pa];

} // end get MemAdr

Simple OS, Tasks, and the LC-3 Simulator

We introduce into our simple-os a new task that is an lc3 Task. An lc3 Task is a running LC-3 simulator that executes an LC-3 program loaded into the LC-3 memory. The memory for the LC-3 simulator, however, is a single global array. This single global array for memory means that alllc3 Tasks created by the shell use the same memory for their programs. As all LC-3 programs start at address 0x3000 in LC-3, each task overwrites another tasks LC-3 program when the scheduler swaps task. The LC-3 simulator (lc3 Task) invokes the SWAP command every several LC-3 instruction cycles. This swap invocation means the scheduler is going to be swapping LC-3 tasks before the tasks actually complete execution so over writing another LC-3 task's memory in the LC-3 simulator is not a good thing.

You are going to implement virtual memory for the LC-3 simulator so up to 32 LC-3 tasks can be active in the LC-3 simulator memory without corrupting each others data. To implement the virtual memory, we have routed all accesses to LC-3 memory through a get Mem Adr function that is the MMU for the LC-3 simulator. In essence, we now have a single LC-3 simulator with a single unified global memory array yet we provide multi-tasking in the simulator for up to 32 LC-3 programs running in their own private address space using virtual memory.

We are implementing a two level page table for the virtual memory in this programming task. A two level table relies on referring to two page tables both indexed by separate page numbers to complete an address translation from a virtual to a physical address. The first table is referred to as the root page table or RPT for short. The root page table is a fixed static table that always resides in memory. There is exactly one RPT per LC-3 task. Always.

The memory layout for the LC=3 simulator including the system (kernel) area that is always resident and non-paged (i.e., no virtual address translation).

The two figures try to illustrate the situation. The lower figure below demonstrates the use of the two level page table. The RPT resident in non-virtual memory is first referenced to get the address of the second level user page table or (UPT) for short. The right figure in purple and green illustrates the memory layout more precisely. Anything below the address 0x3000 is considered non-virtual. The address space is not paged. The memory in the region 0x2400 through 0x3000 is reserved for the RPTs for up to thirty-two LC-3 tasks. These tables are again always present in memory and are not paged. Accessing any RPT does not require any type of address translation.

The addresses that reside above 0x3000 require an address translation. The memory area is in the virtual address space of the program. This virtual address space means that a UPT belonging to any given task is accessed using a virtual address. You must use the RPT in the system memory to keep track of the correct physical address for the UPT location. Once you have the physical address of the UPT you can complete the address translation by finding the data frame and combining it with the page offset to arrive at your final absolute physical address.

A Two-level page table for virtual memory management.

x7000 123F x7000 0042

x7001 6534 x7001 6534

x7002 300F x7002 300F

x7003 4005 after the program is run, memory x7003 4005

x7004 3F19

Zarrin [17]3 years ago
5 0

Answer:

Explanation:

LC-3 Processor:

The LC-3 (Little Computer 3) is an ISA definition for a 16-bit computer. Its architecture includes physical memory mapped I/O via a keyboard and display; TRAPs to the operating system for handling service calls; conditional branches on N, Z, and P condition codes; a subroutine call/return mechanism; a minimal set of operation instructions (ADD, AND, and NOT); and various addressing modes for loads and stores (direct, indirect, Base+offset, PC-relative, and an immediate mode for loading effective addresses). Programs written in LC-3 assembler execute out of a 65536 word memory space. All references to memory, from loading instructions to loading and storing register values, pass through thegetMemAdr() function. The hardware/software function of Project 5 is to translate virtual addresses to physical addresses in a restricted memory space. The following is the default, pass-through, MMU code for all memory references by the LC-3 simulator.

Simple OS, Tasks, and the LC-3 Simulator

We introduce into our simple-os a new task that is an lc3Task. An lc3Task is a running LC-3 simulator that executes an LC-3 program loaded into the LC-3 memory. The memory for the LC-3 simulator, however, is a single global array. This single global array for memory means that alllc3Tasks created by the shell use the same memory for their programs. As all LC-3 programs start at address 0x3000 in LC-3, each task overwrites another tasks LC-3 program when the scheduler swaps task. The LC-3 simulator (lc3Task) invokes the SWAP command every several LC-3 instruction cycles. This swap invocation means the scheduler is going to be swapping LC-3 tasks before the tasks actually complete execution so over writing another LC-3 task's memory in the LC-3 simulator is not a good thing.

You are going to implement virtual memory for the LC-3 simulator so up to 32 LC-3 tasks can be active in the LC-3 simulator memory without corrupting each others data. To implement the virtual memory, we have routed all accesses to LC-3 memory through a getMemAdr function that is the MMU for the LC-3 simulator. In essence, we now have a single LC-3 simulator with a single unified global memory array yet we provide multi-tasking in the simulator for up to 32 LC-3 programs running in their own private address space using virtual memory.

We are implementing a two level page table for the virtual memory in this programming task. A two level table relies on referring to two page tables both indexed by separate page numbers to complete an address translation from a virtual to a physical address. The first table is referred to as the root page table or RPT for short. The root page table is a fixed static table that always resides in memory. There is exactly one RPT per LC-3 task. Always.

The memory layout for the LC=3 simulator including the system (kernel) area that is always resident and non-paged (i.e., no virtual address translation).

The two figures try to illustrate the situation. The lower figure below demonstrates the use of the two level page table. The RPT resident in non-virtual memory is first referenced to get the address of the second level user page table or (UPT) for short. The right figure in purple and green illustrates the memory layout more precisely. Anything below the address 0x3000 is considered non-virtual. The address space is not paged. The memory in the region 0x2400 through 0x3000 is reserved for the RPTs for up to thirty-two LC-3 tasks. These tables are again always present in memory and are not paged. Accessing any RPT does not require any type of address translation.

The addresses that reside above 0x3000 require an address translation. The memory area is in the virtual address space of the program. This virtual address space means that a UPT belonging to any given task is accessed using a virtual address. You must use the RPT in the system memory to keep track of the correct physical address for the UPT location. Once you have the physical address of the UPT you can complete the address translation by finding the data frame and combining it with the page offset to arrive at your final absolute physical address.

This model of having a portion of memory that is not part per se of the virtual address space is not all that unusual. In fact, the lower region of the address space can by thought of as system space where kernel data structures reside. As such, it can be accessed directly without the need for the address translation. Remember, however, that anything above 0x3000 must pass through address translation.

A Two-level page table for virtual memory management.

x7000 123F                                                                            x7000 0042

x7001 6534                                                                            x7001 6534

x7002 300F                                                                            x7002 300F

x7003 4005                after the program is run, memory x7003 4005

x7004 3F19                

You might be interested in
Select the correct answer.
Sladkaya [172]

Answer:

B

Explanation:

hes not presenting, word processing or making spreadsheets and multimedia software can be used to make music

5 0
3 years ago
Read 2 more answers
What are the pros and cons of the internet’s ability to access information
Shkiper50 [21]
THE PRO IS THAT IT ALLOWS PEOPLE TO RESEARCH INFORMATION. THE CON IS THAT PEOPLE ARE ABLE TO DO MEAN THINGS ON THE INTERNET. FOR EXAMPLE, CYBER-BULLYING. PLEASE HIT THE THANKS BUTTON. :)
3 0
3 years ago
Read 2 more answers
Can someone please help me...pls.. how do u delete an account on this app(brainly)..pls help fast​
Basile [38]

Explanation:

The option to delete your account can be found in your Profile Settings under Privacy. Click on the box labeled I want to delete my account, and the request will be sent for the account to be deleted.

6 0
3 years ago
Read 2 more answers
How to cheat on asseeprep
Burka [1]
Just do it just look up the answers mate
6 0
2 years ago
Is it possible to code your own game and if so then where should I go to learn and how to publish it?
const2013 [10]

Answer:

Yes there is

Explanation:

It is scratch a coding game to do almost anything you can also code flappybird

Hope this helps.

Have fun with scratch

4 0
2 years ago
Read 2 more answers
Other questions:
  • What type of lights are necessary for silhouettes?
    12·2 answers
  • kevin is working on a financial project that involves a lot of statistical information. He needs software that allows him to ent
    8·2 answers
  • All of the following activities may infect your computer with a virus EXCEPT ________.
    6·1 answer
  • Class sizes of various sections of college algebra at your university are an example of which type of data? quiizlet
    13·1 answer
  • Many computer magazines and Web sites present comparisons of several DBMSs. Find one such DBMS comparison article and compare th
    10·1 answer
  • Michale spent 80 minutes at the libary he finished studying at 4:00 what time did michale start studying
    8·1 answer
  • The "fathers of the Internet" are Vinton Cerf and ________. Select one: A. Tim Berners-Lee B. Bill Gates C. Robert Kahn D. Rober
    8·1 answer
  • In which circumstances would the view side by side feature be useful or helpful.
    15·2 answers
  • List 10 examples of computer ethics<br>(please give even 1 if you can, I need it urgently) ​
    10·1 answer
  • Your team has provisioned an Auto Scaling Groups in a single Region. The Auto Scaling Group at max capacity would total 40 EC2 i
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!