Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

char line[1000]; //array holding every line of file Writing in c, an assembler that takes in assembly code and outputs in machine code. R-type code

char line[1000]; //array holding every line of file Writing in c, an assembler that takes in assembly code and outputs in machine code. R-type code is displayed here, based on this code, how would you create I-type (lw, sw, beq)?

if(strcmp(tok, "nand") == 0) { while(tok != NULL) { if(currentreg == 1) { destreg = atoi(tok); }//1 if(currentreg == 2) { registera = atoi(tok); }//2 if(currentreg == 3) { registerb = atoi(tok); }//3

tok = strtok(NULL, whitespace); currentreg = currentreg + 1; }//while

opcode = 0 << 22; registera = registera << 19; registerb = registerb << 16; finalnumber = opcode | registera | registerb | destreg; if(fflag) {fprintf(outputfile, "%i ", finalnumber);} else {printf("%i ", finalnumber);} }//nand

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

Step: 3

blur-text-image

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

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

More Books

Students also viewed these Databases questions

Question

Does it avoid use of underlining?

Answered: 1 week ago