You are on page 1of 2

Result: 0s= 5,t= 5

module monitest; Time s t


integer s,t;
initial begin
0 5 5
s=5; 10 6 5
t=5; 20 6 11
forever begin 30 12 11
#10 s=t+1;
#10 t=t+s; 40 12 23
end 50 24 23
end 60 24 47
initial #100 $finish;
initial 70 48 47
begin 80 48 95
$monitor($time, "s=%d,t=%d",s,t); 90 96 95
end
endmodule
100 96 191
4. A priority encoder provides n bits of binary coded output representing the position of the
highest order active input of 2ninputs. If two or more inputs are high at the same time, the input
having the highest priority will take precedence.
Its applications includes
Used to control interrupt requests by acting on the highest priority request.
to encode the output of a flash analog to digital converter
5.
A Gray Code represents numbers using a binary encoding Decimal Binary Gray
0 0000 0000
scheme that groups a sequence of bits so that only one bit in 1 0001 0001
the group changes from the number before and after. A Gray 2 0010 0011
3 0011 0010
Code is useful when rapidly changing values could result in 4 0100 0110
errors due to hardware and interfacing constraints. Many 5 0101 0111
6 0110 0101
rotary mechanical and optical encoders offer Gray Code 7 0111 0100
outputs. A representative Gray Code encoding wheel is 8 1000 1100
9 1001 1101
shown below. Each position on the disk corresponds to a 10 1010 1111
11 1011 1110
binary sequence, with only one bit changing. Ordinary
12 1100 1010
binary is in black font while Gray Code is in red. 13 1101 1011
14 1110 1001
15 1111 1000

7. Simplified Syntax
parameter identifier = constant_expression ,
identifier = constant_expression ;
defparam hierarchical_path = constant_expression ;

If you are using the defparam statement, remember that you have to specify a hierarchical path to your parameter.

3.module BiDir (enable_in_out, data_in, data, tri_inout);


input enable_in_out, data_in;
input data;
inout [3:0]tri_inout;
wire [3:0]tri_inout;
assign enable_in_out = 1 ? ((data_in) ? data : tri_inout) : 1'bz;
endmodule

Bi-directional Buffers :Programmable for inputs or outputs ,Tri-state controls bi-directional


operation,Pull-up/down resistorsFFs/ Latches are used to improve timing issues,Set-up and hold
times,Clock-to-out delay
Routing Resources:Connections to core of array,Programmable I/O voltage and current levels

You might also like