Peruttu

Y86 Simulator

you are going to use C to implement a simulator for the Sequential Y86

architecture. Your input will be a text file that contains first the program counter followed by the

memory. A front end is already written that will read this file into an array where each byte of

memory is a char. Starting at the memory address given to you as the starting program counter,

you will read in bytes and execute the program.

where we ‘disassembled’ the input and looked at what happens in the different stages for each

type of instruction.

For example, consider the partial input given in the box below. The first number (0x0) is the

starting program counter PC. Other values can be used if the program execution can start

elsewhere. The rest of the input is the contents of memory starting at address 0x0. This is what

you will be executing. You start by examining the first byte and then all needed additional bytes

for that instruction. After execution (which may modify the PC), you execute the instruction at

PC, … Start by understanding what the below program should do if simulated.

You will need to implement all of the givenY86 plus some additional instructions to allow you to

dump the contents of registers and memory:

 printall Single byte instruction 0xC0 – prints out the values stored in all 15 registers

 printreg reg – Two byte instruction 0xD0, 0xrA:F – print out the value of the register

indicated by rA

 printmem disp(reg) – 10 byte instruction 0xE0, 0xrA:F, 8 byte displacement – print out

the 8 byte constant stored at address contents(rA) + displacement.

There are examples of all three of these new instructions in the above code. Implement these

first – they will help you debug to real Y86 instructions.

0x0

30F65704000000000000D06FE0EF6800

000000000000406E7000000000000000

E0EF7000000000000000500E68000000

00000000D00F6006D06F733600000000

0000002406D06F6168D08F2589D09F21

89D09F409E6800000000000000E0EF68

0000000000000000CAFEBABE00000000

341200000000

Starting the Assignment

The starting handout, available on blackboard, contains several files:

 simulate.c – this is the file you will be editing

 simulate_main.c – reads the input into the data structure you will be using.

 Makefile - creates executable ‘simulate’

 Two examples to initially try: test1.m and test2.m – Try running ‘simulate test1.m’.

Iniitally doesn’t do much but eventually will execute the Y86 program test1.Y. There is

also a test2.Y. Use the give tools to create other test files.

Implementation Notes

 You will need to use 64-bit (long int) for your registers and other 64-bit values. To print

a 64-bit value in hex, use %lx (rather than %x).

 You must use char type (single byte) and bit-level operators to do your work. Use

masks and shifting to get to the parts of the byte you need to use at a given time. Be

careful about shifting bytes since arithmetic right shifts are used in C. Casting can also

cause problems since sign extension is going to be used.

number will be used as the starting program counter. The tool currently only

produces to file ‘out.m’ but this may be changed in the near future to let you

output to a file you specify.

Taidot: C-ohjelmointi, C++ -ohjelmointi, Tietokannan hallinto, Java, tietojärjestelmäarkkitehtuuri

Näytä lisää: y86-64 simulator, what is y86, y86 tutorial, y86 emulator in c, y86 assembler, c to y86 converter, y86 simulator in c, y86 assembly, auto cad drawing editing steel structure building, auto cad drawing editing steel structure, editing, steel structure, The Positions available are \\\ Customer Service Rep,Data Entry Operator,Sales Management, Autocad, Clerical Admin, Administrati, The Positions available are \ Customer Service Rep,Data Entry Operator,Sales Management, Autocad, Clerical Admin, Administrative, freelance photography videography and editing positions available kildare, editing jobs available

Tietoa työnantajasta:
( 0 arvostelua ) United States

Projektin tunnus: #15635151

1 freelanceria on tarjonnut keskimäärin 250 $ tähän työhön

hbxfnzwpf

İşveren tarafından İşe Alındı

250 $ USD 3 päivässä
(142 arvostelua)
7.0