Hello,
I am trying to create SR Latch with digital output with VerilogA.
Below is my code.
I wonder if someone can point me where I made mistake.
I modified always statement with above or only always without @(), still it does not work.
module verA_latch(S, R, Q, Qbar);
input S, R;
electrical S, R;
output Q, Qbar;
logic Q, Qbar;
reg Q, Qbar;
always @(cross(V(R)-0.6) or cross(V(S)-0.6))
begin
if (V(R)>0.6)
begin
Q = 0;
Qbar = 1;
end
else
if (V(S)>0.6)
begin
Q = 1;
Qbar = 0;
end
else
begin
Q = 0;
Qbar = 1;
end
end
endmodule
***********************************************************************************************************************************
EDIT:
I check myself by trying to write verilogA code for DFF. It works.
`include "constants.vams"
`include "disciplines.vams"
module verAMS_dff (D, CLOCK, Q, Qbar );
input D, CLOCK;
electrical D, CLOCK;
output Q, Qbar;
logic Q, Qbar;
reg Q, Qbar;
always @(cross(V(CLOCK)-0.6))
begin
if (V(D)>0.6)
begin
Q = 1;
Qbar = 0;
end
else
begin
Q = 0;
Qbar = 1;
end
end
endmodule