Starting from:

$30

CS220-Assignment-4 Solved

1. Design an eight-bit adder/subtracter to add/subtract two eight-bit two's complement numbers. Divide your design into three modules. One module implements a one-bit adder/subtracter with four inputs a, b, cin, and opcode and two outputs sum and carry. The input opcode is 0 if the operation is an addition and it is 1 if the operation is a subtraction. The second module implements the eight-bit adder/subtracter using the one-bit adder/subtracter module. This module takes three inputs namely, the two input numbers and the opcode. It produces three outputs namely, the sum, the carry out, and whether there is an overflow. Implement a top module to test your implementation. Keep one time unit gap between two consecutive test input sets.

2. Imagine a 15x15 grid (length of each side is 15). The leftmost bottom corner is (0, 0). The leftmost top corner is (0, 15). The rightmost top corner is (15, 15). The rightmost bottom corner is (15, 0). A worm is sitting at (0, 0) to start with. In each move, the worm can take 0, 1, 2, or 3 steps
along east, west, north, or south directions. If the move causes the worm to hit the boundary, it stops there. For example, at (0, 0) if it tries to move toward west or south it stays at (0 0); at (13 0) if it tries to move toward east three steps, it takes only two steps and stops at (15, 0). Two time units before each rising clock edge a new input is provided. The input comes in the form of a direction (two bits) and the number of steps (two bits). Write a module to compute the new coordinates of the worm based on the input using a five-bit adder/subtracter. The new coordinates are computed on each rising edge of the clock. Write a top module to test your design. You can display the new coordinates along with your inputs just before sending a new input.

More products