verilog assignment-4
verilog assignment-4
2.a)
3.a) Inferred latches happens in combina onal circuits.
Latches will create when there are undefined states , missing signals in sensi vity list .
4.a)
5.a)
Using this code, there is race condi on between two always blocks.
So,we use non-blocking in this code to execute.
CODE:
always @(posedge clk or posedge reset)
begin
if (reset) begin
X1 <= 0; // reset
X2 <= 1; // set
end
else begin
X1 <= X2;
X2 <= X1;
end
end
#) X1 &X2 will swap there values.
6.a) In event ,one process waits for triggering of the other process, this synchronize the two processes.
CODE:
module event_syn( input data,clk,reset,
output data_out);
event received;
always @(posedge clk) begin
if(reset)
received<=0;
else
-> received;
end
always @(received) begin
data_out<=data;
end
endmodule