Given a baud rate of 9600 bits per second, draw the output voltage versus time w
ID: 2084194 • Letter: G
Question
Given a baud rate of 9600 bits per second, draw the output voltage versus time waveform of a serial port transmitting the sequence "EGR" with each character right after the other. What is the total time to transmit the three characters? Write a C function named ALU that takes three integers, labelled inst, rs1, and rs2, and produces a single integer as an output. The first integer, inst, should be 0, 1, 2, or 3. (If it is something else, treat it as a 0.) If inst is 0, the output is the bitwise OR' ing of rs1 and rs2. If inst is 1, the output is the bitwise AND'ing of rs1 and rs2. If inst is 2, the output is the bitwise XOR'ing of rs1 and rs2. If inst is 3, the output is the 2's comp SUM of rs1 and rs2.Explanation / Answer
int ALU(int inst,int rs1,int rs2)
{
int z;
if(inst>4 || inst<0)
inst =0;
if(inst ==0)
z = rs1 | rs2;
else if(inst == 1)
z = rs1 & rs2;
else if(inst ==2)
z = rs1^rs2;
else
z = ~(rs1 + rs2+1);
return z;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.