Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer this and provide a code using C language. 1. Introduction In this assignment, you will work with files to handle input and output.

Please answer this and provide a code using C language.

image text in transcribed

image text in transcribed

1. Introduction In this assignment, you will work with files to handle input and output. Your program will simulate a very simple processor that is controlled using a 32-bi "instruction." The program will decode this instruction to determine what operation should be performed and what values should be used in the computation. Initial register values and instructions will be read from input files, and it prints its results to an output file 2. Deliverables This assignment uses multiple files; starter versions of each file are on the web page: prog10_decode.c: Source file containing your main function. prog10 functions.h: Header file containing function prototypes prog10 functions.c: Source file containing other user-defined functions Submit all three files by uploading these files to your Dropbox folder. Place the files in directly in your shared folder-do not create a sub-folder to hold them. Ensure your file names match the names specified above. Failure to meet this specification will reduce your grade, as described in the program grading guidelines 3. Specifications NOTE: See Section 6 for a full breakdown of instruction encoding, possible opcodes, and detailed information about the program inputs. Variables: Your program should contain, at a minimum, the following variables: e unsigned int inst: The current instruction int regs [32]: Array of register values. If you have an operation that uses RO, . R5, and R22, you'll access regs[0], regs[5l, and regs 221 unsigned int opcode: Instruction field indicating operation to be performed unsigned int dest: Instruction field that holds destination register number. unsigned int srcl: Instruction field with number of first source operand. unsigned int src2: Instruction field with number of second source operand . unsigned int shamt: Instruction field that holds shift amount; only used for left and right shift operations. You will also need variables to handle two different input files-one binary file, one text file-and one output file. You may need other variables to complete the program 1. Introduction In this assignment, you will work with files to handle input and output. Your program will simulate a very simple processor that is controlled using a 32-bi "instruction." The program will decode this instruction to determine what operation should be performed and what values should be used in the computation. Initial register values and instructions will be read from input files, and it prints its results to an output file 2. Deliverables This assignment uses multiple files; starter versions of each file are on the web page: prog10_decode.c: Source file containing your main function. prog10 functions.h: Header file containing function prototypes prog10 functions.c: Source file containing other user-defined functions Submit all three files by uploading these files to your Dropbox folder. Place the files in directly in your shared folder-do not create a sub-folder to hold them. Ensure your file names match the names specified above. Failure to meet this specification will reduce your grade, as described in the program grading guidelines 3. Specifications NOTE: See Section 6 for a full breakdown of instruction encoding, possible opcodes, and detailed information about the program inputs. Variables: Your program should contain, at a minimum, the following variables: e unsigned int inst: The current instruction int regs [32]: Array of register values. If you have an operation that uses RO, . R5, and R22, you'll access regs[0], regs[5l, and regs 221 unsigned int opcode: Instruction field indicating operation to be performed unsigned int dest: Instruction field that holds destination register number. unsigned int srcl: Instruction field with number of first source operand. unsigned int src2: Instruction field with number of second source operand . unsigned int shamt: Instruction field that holds shift amount; only used for left and right shift operations. You will also need variables to handle two different input files-one binary file, one text file-and one output file. You may need other variables to complete the program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions