Quantcast
Channel: Cadence Custom IC Design Forum
Viewing all articles
Browse latest Browse all 4906

VerilogA SR Latch with digital output

$
0
0

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


Viewing all articles
Browse latest Browse all 4906

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>