HBLbits_Verilog Basic_Exams/ece241 2014 q5a
You are to design a one-input one-output serial 2's complementer Moore state machine. The input (x) is a series of bits (one per clock cycle) beginning with the least-significant bit of the number, and the output (Z) is the 2's complement of the input. The machine will accept input numbers of arbitrary length. The circuit requires an asynchronous reset. The conversion begins when Reset is released and stops when Reset is asserted.
For example:
For example:
Example-1:
- Lets take 001 and we know that its 2’s complement is (110+1 = 111).
- So scan from right to left.
- On state A ‘1’ came first to go to stage B and in output write 1.
- On state B replace ‘0’ with ‘1’ and vice-versa.
- So finally we got 111 as output.
- Be aware that the output is also printed in right to left order.
Example-2:
- Lets take 01 and we know that its 2’s complement is (10+1 = 11).
- So scan from right to left.
- On state A ‘1’ came first to go to stage B and in output write 1.
- On state B replace ‘0’ with ‘1’ and vice-versa.
- So finally we got 11 as output.
- Be aware that the output is also printed in right to left order.
1's Complement
2's Complement
module top_module (
沒有留言:
張貼留言