Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. (5 points) Please write the following numbers: 1) Decimal number 120 as a siz

ID: 3749422 • Letter: 1

Question

1. (5 points) Please write the following numbers: 1) Decimal number 120 as a sized 8-bit number in binary. Use_for readability. 2) A 16-bit hexadecimal unknown number with all x's 3) A 4-bit negative 5 in decimal. Write the 2's complement form for this number. 4) An unsized decimal number 12. We assume 32-bit machine and compiler are used 5) For the following three positive numbers, which one is the largest number? (a) 4'bl1 (b) 4'ha (c) 4'10 2. (5 points) Declare the following variables in Verilog: 1) A 1-bit net called input a. 2) An 8-bit vector net called a in. 3) A 32-bit storage register called address. Bit 31 must be the most significant bit. 4) An integer called cout. 5) A memory MEM containing 256 words of 64 bits each.

Explanation / Answer

1)

1. sized 8-bit binary number for decimal 120

8' b 0_1_1_1_1_0_0_0

The number 8 denotes the size of the binary number. The letter 'b' denotes that it is a binary number. Since the decimal 120 is of only 7 bits(1111000) in binary, one '0' is padded to left of the number to make it as 8-bit number.

2.16-bit hexa decimal unknown number, with all x's:

16'hx

It is also equal to 16'hxxxxxxxxxxxxxxxx

3.4-bit negative 5 in decimal:

-4'd5

2's compliment form of this number:

4'b 1011

4. Unsized decimal number 12 with 32-bit machine used:

32'd12

5. The largest number is:

4'b1111

It is equal to decimal 15. The rest are all equal to decimal 10.

2.

1. 1-bit net input_a variable:

wire input_a;

2. 8-bit vector net a_in variable:

wire [7:0] a_in;

3.32-bit storage register address:

reg [31:0] address;

4. Integer cout:

Integer cout;

5.Memory MEM containing 256 words of 64 bits each:

reg [63:0] MEM [255:0];