fran6
Newbie level 4
Hello,
When I wanted to have a value latched in a module, I have always done:
With the above code, it is clear that the input is latched synchronously to the clock clk.
An other way to latch an input is to declare myinput as "input reg":
I am wondering when the value of myinput is updated ? Which clock is used to supply this register ?
regards,
Fran6
When I wanted to have a value latched in a module, I have always done:
Code:
module my_module(clk, myinput);
input wire clk;
input wire myinput;
reg latch_myinput;
always @(posedge clk)
begin
latch_myinput = myinput;
end
endmodule
With the above code, it is clear that the input is latched synchronously to the clock clk.
An other way to latch an input is to declare myinput as "input reg":
Code:
module my_module(clk, myinput);
input wire clk;
input reg myinput;
endmodule
I am wondering when the value of myinput is updated ? Which clock is used to supply this register ?
regards,
Fran6