Question: a) Write a Verilog function that will create the 2s complement of an N-bit vector. Use a call of the form comp2(bit_vec, N), where bit_vec
a) Write a Verilog function that will create the 2’s complement of an N-bit vector. Use a call of the form comp2(bit_vec, N), where bit_vec is the vector and N is the length of the vector. Do the complement on a bit-by-bit basis using a loop. You may declare N as a global parameter in the calling module.
(b) Write a Verilog module that will call the function in part (a).
Step by Step Solution
3.33 Rating (168 Votes )
There are 3 Steps involved in it
a function N 1 0 comp2 input N 1 0 vect input 31 0 ... View full answer
Get step-by-step solutions from verified subject matter experts
