Due: Friday, October 11, 2024, 11:00 am (start of the class)

Email Ying your homework. The email subject should follow this format CS232 Fall2024 HW4 -- Your Name.

Given the extended Count circuit below, assume RA and RB are four bits. Write an assembly program by using the mnemonics, LOAD, ADD, NOT, XOR, BRZ, BRA for the following questions. Then translate each assembly program (a program uses the mnemonics) into machine instructions (binary sequences).

The explanation of each mnemonic is listed below.

Some examples for translating assembly program into machine instructions.

Questions for you to implement:

  1. Subtract RA from RB and put the result in RA. Use whatever values stored in RA and RB for this computation. Don’t need to initialize RA and RB. Do not modify RB. Hint: this count does not have subtraction. But B - A is the same as B + (-A).

  2. Adds the numbers 7, 6, 5, 4, 3, and put the result in RA after the loop terminates. Hint: The loop is terminated when RA is 3. Since the conditional branching can branch only if the ALU result is 0, so, in each iteration, we can decrement RA by 3. If the result is 0, then break out of the loop; Otherwise, add 2 to the result, which will make RA decrement by 1 each time.

© 2024 Ying Li. Page last modified: .