CSC2636, CSCW Course: Assignment 1 Overview Assignment 1 Page: .
Assignment 1
-
Upload
mohammed-nawaz-shaik -
Category
Documents
-
view
9 -
download
4
description
Transcript of Assignment 1
1. Given the following code sample:byte my_byte;
integer my_integer = 32’b0000_1111_xxxx_zzzz;
int my_int = my_integer;
bit [15:0] my_bit = 16’h8000;
shortint my_short_int1= my_bit;
shortint my_short_int2 = my_short_int1-1;
a.What is the decimal range of values my_byte can take?
b.What is the value of:
my_integer?
my_int in hex?
my_bit in decimal?
my_short_int1 in decimal?
my_short_int2 in decimal?
2. Given the following code sample:
bit [7:0] my_mem [3] = '{default:8'hA5};
logic [3:0] my_logicmem [4] = '{0,1,2,3};
logic [3:0] my_logic = 4’hF;
Evaluate in order:
my_mem[2] = my_logicmem[4];
my_logic = my_logicmem[4];
my_logicmem[3] = my_mem[3];
my_mem[3] = my_logic;
my_logic = my_logicmem[1];
my_logic = my_mem[1];
my_logic = my_logicmem[my_logicmem[4]];
3. Write the SystemVerilog code to: 1)Declare a 2-state array, my_array, that holds four 12-bit values
2)initialize my_array so that: 1)my_array[0] = 12’h012
2)my_array[1] = 12’h345,
3)my_array[2] = 12’h678,
4)my_array[3] = 12’h9AB;
3) Traverse my_array and print out bits [5:4] of each 12-bit element
1)Using a for loop
2)Using a foreach loop