Latch cells

The cell types $_DLATCH_N_ and $_DLATCH_P_ represent d-type latches.

Table 15 Cell types for basic latches

Verilog

Cell Type

always @* if (!E) Q <= D

$_DLATCH_N_

always @* if (E) Q <= D

$_DLATCH_P_

The cell types $_DLATCH_[NP][NP][01]_ implement d-type latches with reset. The values in the table for these cell types relate to the following Verilog code template:

always @*
   if (R == RST_LVL)
      Q <= RST_VAL;
   else if (E == EN_LVL)
      Q <= D;
Table 16 Cell types for gate level logic networks (latches with reset)

\(EnLvl\)

\(RstLvl\)

\(RstVal\)

Cell Type

0

0

0

$_DLATCH_NN0_

0

0

1

$_DLATCH_NN1_

0

1

0

$_DLATCH_NP0_

0

1

1

$_DLATCH_NP1_

1

0

0

$_DLATCH_PN0_

1

0

1

$_DLATCH_PN1_

1

1

0

$_DLATCH_PP0_

1

1

1

$_DLATCH_PP1_

The cell types $_DLATCHSR_[NP][NP][NP]_ implement d-type latches with set and reset. The values in the table for these cell types relate to the following Verilog code template:

always @*
   if (R == RST_LVL)
      Q <= 0;
   else if (S == SET_LVL)
      Q <= 1;
   else if (E == EN_LVL)
      Q <= D;
Table 17 Cell types for gate level logic networks (latches with set and reset)

\(EnLvl\)

\(SetLvl\)

\(RstLvl\)

Cell Type

0

0

0

$_DLATCHSR_NNN_

0

0

1

$_DLATCHSR_NNP_

0

1

0

$_DLATCHSR_NPN_

0

1

1

$_DLATCHSR_NPP_

1

0

0

$_DLATCHSR_PNN_

1

0

1

$_DLATCHSR_PNP_

1

1

0

$_DLATCHSR_PPN_

1

1

1

$_DLATCHSR_PPP_

The cell types $_SR_[NP][NP]_ implement sr-type latches. The values in the table for these cell types relate to the following Verilog code template:

always @*
   if (R == RST_LVL)
      Q <= 0;
   else if (S == SET_LVL)
      Q <= 1;
Table 18 Cell types for gate level logic networks (SR latches)

\(SetLvl\)

\(RstLvl\)

Cell Type

0

0

$_SR_NN_

0

1

$_SR_NP_

1

0

$_SR_PN_

1

1

$_SR_PP_

yosys> help $_DLATCHSR_NNN_

A negative enable D-type latch with negative polarity set and negative polarity reset.

Truth table:    E S R D | Q
               ---------+---
                - - 0 - | 0
                - 0 - - | 1
                0 - - d | d
                - - - - | q
Simulation model (verilog)
Listing 341 simcells.v
3551module \$_DLATCHSR_NNN_ (E, S, R, D, Q);
3552    input E, S, R, D;
3553    output reg Q;
3554    always @* begin
3555        if (R == 0)
3556            Q <= 0;
3557        else if (S == 0)
3558            Q <= 1;
3559        else if (E == 0)
3560            Q <= D;
3561    end
3562endmodule
yosys> help $_DLATCHSR_NNP_

A negative enable D-type latch with negative polarity set and positive polarity reset.

Truth table:    E S R D | Q
               ---------+---
                - - 1 - | 0
                - 0 - - | 1
                0 - - d | d
                - - - - | q
Simulation model (verilog)
Listing 342 simcells.v
3579module \$_DLATCHSR_NNP_ (E, S, R, D, Q);
3580    input E, S, R, D;
3581    output reg Q;
3582    always @* begin
3583        if (R == 1)
3584            Q <= 0;
3585        else if (S == 0)
3586            Q <= 1;
3587        else if (E == 0)
3588            Q <= D;
3589    end
3590endmodule
yosys> help $_DLATCHSR_NPN_

A negative enable D-type latch with positive polarity set and negative polarity reset.

Truth table:    E S R D | Q
               ---------+---
                - - 0 - | 0
                - 1 - - | 1
                0 - - d | d
                - - - - | q
Simulation model (verilog)
Listing 343 simcells.v
3607module \$_DLATCHSR_NPN_ (E, S, R, D, Q);
3608    input E, S, R, D;
3609    output reg Q;
3610    always @* begin
3611        if (R == 0)
3612            Q <= 0;
3613        else if (S == 1)
3614            Q <= 1;
3615        else if (E == 0)
3616            Q <= D;
3617    end
3618endmodule
yosys> help $_DLATCHSR_NPP_

A negative enable D-type latch with positive polarity set and positive polarity reset.

Truth table:    E S R D | Q
               ---------+---
                - - 1 - | 0
                - 1 - - | 1
                0 - - d | d
                - - - - | q
Simulation model (verilog)
Listing 344 simcells.v
3635module \$_DLATCHSR_NPP_ (E, S, R, D, Q);
3636    input E, S, R, D;
3637    output reg Q;
3638    always @* begin
3639        if (R == 1)
3640            Q <= 0;
3641        else if (S == 1)
3642            Q <= 1;
3643        else if (E == 0)
3644            Q <= D;
3645    end
3646endmodule
yosys> help $_DLATCHSR_PNN_

A positive enable D-type latch with negative polarity set and negative polarity reset.

Truth table:    E S R D | Q
               ---------+---
                - - 0 - | 0
                - 0 - - | 1
                1 - - d | d
                - - - - | q
Simulation model (verilog)
Listing 345 simcells.v
3663module \$_DLATCHSR_PNN_ (E, S, R, D, Q);
3664    input E, S, R, D;
3665    output reg Q;
3666    always @* begin
3667        if (R == 0)
3668            Q <= 0;
3669        else if (S == 0)
3670            Q <= 1;
3671        else if (E == 1)
3672            Q <= D;
3673    end
3674endmodule
yosys> help $_DLATCHSR_PNP_

A positive enable D-type latch with negative polarity set and positive polarity reset.

Truth table:    E S R D | Q
               ---------+---
                - - 1 - | 0
                - 0 - - | 1
                1 - - d | d
                - - - - | q
Simulation model (verilog)
Listing 346 simcells.v
3691module \$_DLATCHSR_PNP_ (E, S, R, D, Q);
3692    input E, S, R, D;
3693    output reg Q;
3694    always @* begin
3695        if (R == 1)
3696            Q <= 0;
3697        else if (S == 0)
3698            Q <= 1;
3699        else if (E == 1)
3700            Q <= D;
3701    end
3702endmodule
yosys> help $_DLATCHSR_PPN_

A positive enable D-type latch with positive polarity set and negative polarity reset.

Truth table:    E S R D | Q
               ---------+---
                - - 0 - | 0
                - 1 - - | 1
                1 - - d | d
                - - - - | q
Simulation model (verilog)
Listing 347 simcells.v
3719module \$_DLATCHSR_PPN_ (E, S, R, D, Q);
3720    input E, S, R, D;
3721    output reg Q;
3722    always @* begin
3723        if (R == 0)
3724            Q <= 0;
3725        else if (S == 1)
3726            Q <= 1;
3727        else if (E == 1)
3728            Q <= D;
3729    end
3730endmodule
yosys> help $_DLATCHSR_PPP_

A positive enable D-type latch with positive polarity set and positive polarity reset.

Truth table:    E S R D | Q
               ---------+---
                - - 1 - | 0
                - 1 - - | 1
                1 - - d | d
                - - - - | q
Simulation model (verilog)
Listing 348 simcells.v
3747module \$_DLATCHSR_PPP_ (E, S, R, D, Q);
3748    input E, S, R, D;
3749    output reg Q;
3750    always @* begin
3751        if (R == 1)
3752            Q <= 0;
3753        else if (S == 1)
3754            Q <= 1;
3755        else if (E == 1)
3756            Q <= D;
3757    end
3758endmodule
yosys> help $_DLATCH_NN0_

A negative enable D-type latch with negative polarity reset.

Truth table:    E R D | Q
               -------+---
                - 0 - | 0
                0 - d | d
                - - - | q
Simulation model (verilog)
Listing 349 simcells.v
3357module \$_DLATCH_NN0_ (E, R, D, Q);
3358    input E, R, D;
3359    output reg Q;
3360    always @* begin
3361        if (R == 0)
3362                    Q <= 0;
3363        else if (E == 0)
3364            Q <= D;
3365    end
3366endmodule
yosys> help $_DLATCH_NN1_

A negative enable D-type latch with negative polarity set.

Truth table:    E R D | Q
               -------+---
                - 0 - | 1
                0 - d | d
                - - - | q
Simulation model (verilog)
Listing 350 simcells.v
3381module \$_DLATCH_NN1_ (E, R, D, Q);
3382    input E, R, D;
3383    output reg Q;
3384    always @* begin
3385        if (R == 0)
3386                    Q <= 1;
3387        else if (E == 0)
3388            Q <= D;
3389    end
3390endmodule
yosys> help $_DLATCH_NP0_

A negative enable D-type latch with positive polarity reset.

Truth table:    E R D | Q
               -------+---
                - 1 - | 0
                0 - d | d
                - - - | q
Simulation model (verilog)
Listing 351 simcells.v
3405module \$_DLATCH_NP0_ (E, R, D, Q);
3406    input E, R, D;
3407    output reg Q;
3408    always @* begin
3409        if (R == 1)
3410                    Q <= 0;
3411        else if (E == 0)
3412            Q <= D;
3413    end
3414endmodule
yosys> help $_DLATCH_NP1_

A negative enable D-type latch with positive polarity set.

Truth table:    E R D | Q
               -------+---
                - 1 - | 1
                0 - d | d
                - - - | q
Simulation model (verilog)
Listing 352 simcells.v
3429module \$_DLATCH_NP1_ (E, R, D, Q);
3430    input E, R, D;
3431    output reg Q;
3432    always @* begin
3433        if (R == 1)
3434                    Q <= 1;
3435        else if (E == 0)
3436            Q <= D;
3437    end
3438endmodule
yosys> help $_DLATCH_N_

A negative enable D-type latch.

Truth table:    E D | Q
               -----+---
                0 d | d
                - - | q
Simulation model (verilog)
Listing 353 simcells.v
3314module \$_DLATCH_N_ (E, D, Q);
3315    input E, D;
3316    output reg Q;
3317    always @* begin
3318        if (E == 0)
3319            Q <= D;
3320    end
3321endmodule
yosys> help $_DLATCH_PN0_

A positive enable D-type latch with negative polarity reset.

Truth table:    E R D | Q
               -------+---
                - 0 - | 0
                1 - d | d
                - - - | q
Simulation model (verilog)
Listing 354 simcells.v
3453module \$_DLATCH_PN0_ (E, R, D, Q);
3454    input E, R, D;
3455    output reg Q;
3456    always @* begin
3457        if (R == 0)
3458                    Q <= 0;
3459        else if (E == 1)
3460            Q <= D;
3461    end
3462endmodule
yosys> help $_DLATCH_PN1_

A positive enable D-type latch with negative polarity set.

Truth table:    E R D | Q
               -------+---
                - 0 - | 1
                1 - d | d
                - - - | q
Simulation model (verilog)
Listing 355 simcells.v
3477module \$_DLATCH_PN1_ (E, R, D, Q);
3478    input E, R, D;
3479    output reg Q;
3480    always @* begin
3481        if (R == 0)
3482                    Q <= 1;
3483        else if (E == 1)
3484            Q <= D;
3485    end
3486endmodule
yosys> help $_DLATCH_PP0_

A positive enable D-type latch with positive polarity reset.

Truth table:    E R D | Q
               -------+---
                - 1 - | 0
                1 - d | d
                - - - | q
Simulation model (verilog)
Listing 356 simcells.v
3501module \$_DLATCH_PP0_ (E, R, D, Q);
3502    input E, R, D;
3503    output reg Q;
3504    always @* begin
3505        if (R == 1)
3506                    Q <= 0;
3507        else if (E == 1)
3508            Q <= D;
3509    end
3510endmodule
yosys> help $_DLATCH_PP1_

A positive enable D-type latch with positive polarity set.

Truth table:    E R D | Q
               -------+---
                - 1 - | 1
                1 - d | d
                - - - | q
Simulation model (verilog)
Listing 357 simcells.v
3525module \$_DLATCH_PP1_ (E, R, D, Q);
3526    input E, R, D;
3527    output reg Q;
3528    always @* begin
3529        if (R == 1)
3530                    Q <= 1;
3531        else if (E == 1)
3532            Q <= D;
3533    end
3534endmodule
yosys> help $_DLATCH_P_

A positive enable D-type latch.

Truth table:    E D | Q
               -----+---
                1 d | d
                - - | q
Simulation model (verilog)
Listing 358 simcells.v
3335module \$_DLATCH_P_ (E, D, Q);
3336    input E, D;
3337    output reg Q;
3338    always @* begin
3339        if (E == 1)
3340            Q <= D;
3341    end
3342endmodule
yosys> help $_SR_NN_

A set-reset latch with negative polarity SET and negative polarity RESET.

Truth table:    S R | Q
               -----+---
                - 0 | 0
                0 - | 1
                - - | q
Simulation model (verilog)
Listing 359 simcells.v
497module \$_SR_NN_ (S, R, Q);
498    input S, R;
499    output reg Q;
500    always @* begin
501        if (R == 0)
502            Q <= 0;
503        else if (S == 0)
504            Q <= 1;
505    end
506endmodule
yosys> help $_SR_NP_

A set-reset latch with negative polarity SET and positive polarity RESET.

Truth table:    S R | Q
               -----+---
                - 1 | 0
                0 - | 1
                - - | q
Simulation model (verilog)
Listing 360 simcells.v
521module \$_SR_NP_ (S, R, Q);
522    input S, R;
523    output reg Q;
524    always @* begin
525        if (R == 1)
526            Q <= 0;
527        else if (S == 0)
528            Q <= 1;
529    end
530endmodule
yosys> help $_SR_PN_

A set-reset latch with positive polarity SET and negative polarity RESET.

Truth table:    S R | Q
               -----+---
                - 0 | 0
                1 - | 1
                - - | q
Simulation model (verilog)
Listing 361 simcells.v
545module \$_SR_PN_ (S, R, Q);
546    input S, R;
547    output reg Q;
548    always @* begin
549        if (R == 0)
550            Q <= 0;
551        else if (S == 1)
552            Q <= 1;
553    end
554endmodule
yosys> help $_SR_PP_

A set-reset latch with positive polarity SET and positive polarity RESET.

Truth table:    S R | Q
               -----+---
                - 1 | 0
                1 - | 1
                - - | q
Simulation model (verilog)
Listing 362 simcells.v
569module \$_SR_PP_ (S, R, Q);
570    input S, R;
571    output reg Q;
572    always @* begin
573        if (R == 1)
574            Q <= 0;
575        else if (S == 1)
576            Q <= 1;
577    end
578endmodule