1/* 2 * yosys -- Yosys Open SYnthesis Suite 3 * 4 * Copyright (C) 2012 Claire Xenia Wolf <claire@yosyshq.com> 5 * 6 * Permission to use, copy, modify, and/or distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 * 18 * --- 19 * 20 * The internal logic cell simulation library. 21 * 22 * This Verilog library contains simple simulation models for the internal 23 * logic cells ($_NOT_ , $_AND_ , ...) that are generated by the default technology 24 * mapper (see "techmap.v" in this directory) and expected by the "abc" pass. 25 * 26 */ 27 28// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 29//- 30//- $_BUF_ (A, Y) 31//- 32//- A buffer. This cell type is always optimized away by the opt_clean pass. 33//- 34//- Truth table: A | Y 35//- ---+--- 36//- 0 | 0 37//- 1 | 1 38//- 39module \$_BUF_ (A, Y); 40input A; 41output Y; 42assign Y = A; 43endmodule 44 45// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 46//- 47//- $_NOT_ (A, Y) 48//- 49//- An inverter gate. 50//- 51//- Truth table: A | Y 52//- ---+--- 53//- 0 | 1 54//- 1 | 0 55//- 56module \$_NOT_ (A, Y); 57input A; 58output Y; 59assign Y = ~A; 60endmodule 61 62// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 63//- 64//- $_AND_ (A, B, Y) 65//- 66//- A 2-input AND gate. 67//- 68//- Truth table: A B | Y 69//- -----+--- 70//- 0 0 | 0 71//- 0 1 | 0 72//- 1 0 | 0 73//- 1 1 | 1 74//- 75module \$_AND_ (A, B, Y); 76input A, B; 77output Y; 78assign Y = A & B; 79endmodule 80 81// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 82//- 83//- $_NAND_ (A, B, Y) 84//- 85//- A 2-input NAND gate. 86//- 87//- Truth table: A B | Y 88//- -----+--- 89//- 0 0 | 1 90//- 0 1 | 1 91//- 1 0 | 1 92//- 1 1 | 0 93//- 94module \$_NAND_ (A, B, Y); 95input A, B; 96output Y; 97assign Y = ~(A & B); 98endmodule 99 100// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 101//- 102//- $_OR_ (A, B, Y) 103//- 104//- A 2-input OR gate. 105//- 106//- Truth table: A B | Y 107//- -----+--- 108//- 0 0 | 0 109//- 0 1 | 1 110//- 1 0 | 1 111//- 1 1 | 1 112//- 113module \$_OR_ (A, B, Y); 114input A, B; 115output Y; 116assign Y = A | B; 117endmodule 118 119// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 120//- 121//- $_NOR_ (A, B, Y) 122//- 123//- A 2-input NOR gate. 124//- 125//- Truth table: A B | Y 126//- -----+--- 127//- 0 0 | 1 128//- 0 1 | 0 129//- 1 0 | 0 130//- 1 1 | 0 131//- 132module \$_NOR_ (A, B, Y); 133input A, B; 134output Y; 135assign Y = ~(A | B); 136endmodule 137 138// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 139//- 140//- $_XOR_ (A, B, Y) 141//- 142//- A 2-input XOR gate. 143//- 144//- Truth table: A B | Y 145//- -----+--- 146//- 0 0 | 0 147//- 0 1 | 1 148//- 1 0 | 1 149//- 1 1 | 0 150//- 151module \$_XOR_ (A, B, Y); 152input A, B; 153output Y; 154assign Y = A ^ B; 155endmodule 156 157// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 158//- 159//- $_XNOR_ (A, B, Y) 160//- 161//- A 2-input XNOR gate. 162//- 163//- Truth table: A B | Y 164//- -----+--- 165//- 0 0 | 1 166//- 0 1 | 0 167//- 1 0 | 0 168//- 1 1 | 1 169//- 170module \$_XNOR_ (A, B, Y); 171input A, B; 172output Y; 173assign Y = ~(A ^ B); 174endmodule 175 176// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 177//- 178//- $_ANDNOT_ (A, B, Y) 179//- 180//- A 2-input AND-NOT gate. 181//- 182//- Truth table: A B | Y 183//- -----+--- 184//- 0 0 | 0 185//- 0 1 | 0 186//- 1 0 | 1 187//- 1 1 | 0 188//- 189module \$_ANDNOT_ (A, B, Y); 190input A, B; 191output Y; 192assign Y = A & (~B); 193endmodule 194 195// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 196//- 197//- $_ORNOT_ (A, B, Y) 198//- 199//- A 2-input OR-NOT gate. 200//- 201//- Truth table: A B | Y 202//- -----+--- 203//- 0 0 | 1 204//- 0 1 | 0 205//- 1 0 | 1 206//- 1 1 | 1 207//- 208module \$_ORNOT_ (A, B, Y); 209input A, B; 210output Y; 211assign Y = A | (~B); 212endmodule 213 214// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 215//- 216//- $_MUX_ (A, B, S, Y) 217//- 218//- A 2-input MUX gate. 219//- 220//- Truth table: A B S | Y 221//- -------+--- 222//- a - 0 | a 223//- - b 1 | b 224//- 225module \$_MUX_ (A, B, S, Y); 226input A, B, S; 227output Y; 228assign Y = S ? B : A; 229endmodule 230 231// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 232//- 233//- $_NMUX_ (A, B, S, Y) 234//- 235//- A 2-input inverting MUX gate. 236//- 237//- Truth table: A B S | Y 238//- -------+--- 239//- 0 - 0 | 1 240//- 1 - 0 | 0 241//- - 0 1 | 1 242//- - 1 1 | 0 243//- 244module \$_NMUX_ (A, B, S, Y); 245input A, B, S; 246output Y; 247assign Y = S ? !B : !A; 248endmodule 249 250// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 251//- 252//- $_MUX4_ (A, B, C, D, S, T, Y) 253//- 254//- A 4-input MUX gate. 255//- 256//- Truth table: A B C D S T | Y 257//- -------------+--- 258//- a - - - 0 0 | a 259//- - b - - 1 0 | b 260//- - - c - 0 1 | c 261//- - - - d 1 1 | d 262//- 263module \$_MUX4_ (A, B, C, D, S, T, Y); 264input A, B, C, D, S, T; 265output Y; 266assign Y = T ? (S ? D : C) : 267 (S ? B : A); 268endmodule 269 270// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 271//- 272//- $_MUX8_ (A, B, C, D, E, F, G, H, S, T, U, Y) 273//- 274//- An 8-input MUX gate. 275//- 276//- Truth table: A B C D E F G H S T U | Y 277//- -----------------------+--- 278//- a - - - - - - - 0 0 0 | a 279//- - b - - - - - - 1 0 0 | b 280//- - - c - - - - - 0 1 0 | c 281//- - - - d - - - - 1 1 0 | d 282//- - - - - e - - - 0 0 1 | e 283//- - - - - - f - - 1 0 1 | f 284//- - - - - - - g - 0 1 1 | g 285//- - - - - - - - h 1 1 1 | h 286//- 287module \$_MUX8_ (A, B, C, D, E, F, G, H, S, T, U, Y); 288input A, B, C, D, E, F, G, H, S, T, U; 289output Y; 290assign Y = U ? T ? (S ? H : G) : 291 (S ? F : E) : 292 T ? (S ? D : C) : 293 (S ? B : A); 294endmodule 295 296// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 297//- 298//- $_MUX16_ (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, S, T, U, V, Y) 299//- 300//- A 16-input MUX gate. 301//- 302//- Truth table: A B C D E F G H I J K L M N O P S T U V | Y 303//- -----------------------------------------+--- 304//- a - - - - - - - - - - - - - - - 0 0 0 0 | a 305//- - b - - - - - - - - - - - - - - 1 0 0 0 | b 306//- - - c - - - - - - - - - - - - - 0 1 0 0 | c 307//- - - - d - - - - - - - - - - - - 1 1 0 0 | d 308//- - - - - e - - - - - - - - - - - 0 0 1 0 | e 309//- - - - - - f - - - - - - - - - - 1 0 1 0 | f 310//- - - - - - - g - - - - - - - - - 0 1 1 0 | g 311//- - - - - - - - h - - - - - - - - 1 1 1 0 | h 312//- - - - - - - - - i - - - - - - - 0 0 0 1 | i 313//- - - - - - - - - - j - - - - - - 1 0 0 1 | j 314//- - - - - - - - - - - k - - - - - 0 1 0 1 | k 315//- - - - - - - - - - - - l - - - - 1 1 0 1 | l 316//- - - - - - - - - - - - - m - - - 0 0 1 1 | m 317//- - - - - - - - - - - - - - n - - 1 0 1 1 | n 318//- - - - - - - - - - - - - - - o - 0 1 1 1 | o 319//- - - - - - - - - - - - - - - - p 1 1 1 1 | p 320//- 321module \$_MUX16_ (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, S, T, U, V, Y); 322input A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, S, T, U, V; 323output Y; 324assign Y = V ? U ? T ? (S ? P : O) : 325 (S ? N : M) : 326 T ? (S ? L : K) : 327 (S ? J : I) : 328 U ? T ? (S ? H : G) : 329 (S ? F : E) : 330 T ? (S ? D : C) : 331 (S ? B : A); 332endmodule 333 334// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 335//- 336//- $_AOI3_ (A, B, C, Y) 337//- 338//- A 3-input And-Or-Invert gate. 339//- 340//- Truth table: A B C | Y 341//- -------+--- 342//- 0 0 0 | 1 343//- 0 0 1 | 0 344//- 0 1 0 | 1 345//- 0 1 1 | 0 346//- 1 0 0 | 1 347//- 1 0 1 | 0 348//- 1 1 0 | 0 349//- 1 1 1 | 0 350//- 351module \$_AOI3_ (A, B, C, Y); 352input A, B, C; 353output Y; 354assign Y = ~((A & B) | C); 355endmodule 356 357// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 358//- 359//- $_OAI3_ (A, B, C, Y) 360//- 361//- A 3-input Or-And-Invert gate. 362//- 363//- Truth table: A B C | Y 364//- -------+--- 365//- 0 0 0 | 1 366//- 0 0 1 | 1 367//- 0 1 0 | 1 368//- 0 1 1 | 0 369//- 1 0 0 | 1 370//- 1 0 1 | 0 371//- 1 1 0 | 1 372//- 1 1 1 | 0 373//- 374module \$_OAI3_ (A, B, C, Y); 375input A, B, C; 376output Y; 377assign Y = ~((A | B) & C); 378endmodule 379 380// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 381//- 382//- $_AOI4_ (A, B, C, Y) 383//- 384//- A 4-input And-Or-Invert gate. 385//- 386//- Truth table: A B C D | Y 387//- ---------+--- 388//- 0 0 0 0 | 1 389//- 0 0 0 1 | 1 390//- 0 0 1 0 | 1 391//- 0 0 1 1 | 0 392//- 0 1 0 0 | 1 393//- 0 1 0 1 | 1 394//- 0 1 1 0 | 1 395//- 0 1 1 1 | 0 396//- 1 0 0 0 | 1 397//- 1 0 0 1 | 1 398//- 1 0 1 0 | 1 399//- 1 0 1 1 | 0 400//- 1 1 0 0 | 0 401//- 1 1 0 1 | 0 402//- 1 1 1 0 | 0 403//- 1 1 1 1 | 0 404//- 405module \$_AOI4_ (A, B, C, D, Y); 406input A, B, C, D; 407output Y; 408assign Y = ~((A & B) | (C & D)); 409endmodule 410 411// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 412//- 413//- $_OAI4_ (A, B, C, Y) 414//- 415//- A 4-input Or-And-Invert gate. 416//- 417//- Truth table: A B C D | Y 418//- ---------+--- 419//- 0 0 0 0 | 1 420//- 0 0 0 1 | 1 421//- 0 0 1 0 | 1 422//- 0 0 1 1 | 1 423//- 0 1 0 0 | 1 424//- 0 1 0 1 | 0 425//- 0 1 1 0 | 0 426//- 0 1 1 1 | 0 427//- 1 0 0 0 | 1 428//- 1 0 0 1 | 0 429//- 1 0 1 0 | 0 430//- 1 0 1 1 | 0 431//- 1 1 0 0 | 1 432//- 1 1 0 1 | 0 433//- 1 1 1 0 | 0 434//- 1 1 1 1 | 0 435//- 436module \$_OAI4_ (A, B, C, D, Y); 437input A, B, C, D; 438output Y; 439assign Y = ~((A | B) & (C | D)); 440endmodule 441 442// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 443//- 444//- $_TBUF_ (A, E, Y) 445//- 446//- A tri-state buffer. 447//- 448//- Truth table: A E | Y 449//- -----+--- 450//- a 1 | a 451//- - 0 | z 452//- 453module \$_TBUF_ (A, E, Y); 454input A, E; 455output Y; 456assign Y = E ? A : 1'bz; 457endmodule 458 459// NOTE: the following cell types are autogenerated. DO NOT EDIT them manually, 460// instead edit the templates in gen_ff_types.py and rerun it. 461 462// START AUTOGENERATED CELL TYPES 463 464// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 465//- 466//- $_SR_NN_ (S, R, Q) 467//- 468//- A set-reset latch with negative polarity SET and negative polarity RESET. 469//- 470//- Truth table: S R | Q 471//- -----+--- 472//- - 0 | 0 473//- 0 - | 1 474//- - - | q 475//- 476module \$_SR_NN_ (S, R, Q); 477input S, R; 478output reg Q; 479always @* begin 480 if (R == 0) 481 Q <= 0; 482 else if (S == 0) 483 Q <= 1; 484end 485endmodule 486 487// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 488//- 489//- $_SR_NP_ (S, R, Q) 490//- 491//- A set-reset latch with negative polarity SET and positive polarity RESET. 492//- 493//- Truth table: S R | Q 494//- -----+--- 495//- - 1 | 0 496//- 0 - | 1 497//- - - | q 498//- 499module \$_SR_NP_ (S, R, Q); 500input S, R; 501output reg Q; 502always @* begin 503 if (R == 1) 504 Q <= 0; 505 else if (S == 0) 506 Q <= 1; 507end 508endmodule 509 510// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 511//- 512//- $_SR_PN_ (S, R, Q) 513//- 514//- A set-reset latch with positive polarity SET and negative polarity RESET. 515//- 516//- Truth table: S R | Q 517//- -----+--- 518//- - 0 | 0 519//- 1 - | 1 520//- - - | q 521//- 522module \$_SR_PN_ (S, R, Q); 523input S, R; 524output reg Q; 525always @* begin 526 if (R == 0) 527 Q <= 0; 528 else if (S == 1) 529 Q <= 1; 530end 531endmodule 532 533// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 534//- 535//- $_SR_PP_ (S, R, Q) 536//- 537//- A set-reset latch with positive polarity SET and positive polarity RESET. 538//- 539//- Truth table: S R | Q 540//- -----+--- 541//- - 1 | 0 542//- 1 - | 1 543//- - - | q 544//- 545module \$_SR_PP_ (S, R, Q); 546input S, R; 547output reg Q; 548always @* begin 549 if (R == 1) 550 Q <= 0; 551 else if (S == 1) 552 Q <= 1; 553end 554endmodule 555 556`ifdef SIMCELLS_FF 557// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 558//- 559//- $_FF_ (D, Q) 560//- 561//- A D-type flip-flop that is clocked from the implicit global clock. (This cell 562//- type is usually only used in netlists for formal verification.) 563//- 564module \$_FF_ (D, Q); 565input D; 566output reg Q; 567always @($global_clock) begin 568 Q <= D; 569end 570endmodule 571`endif 572 573// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 574//- 575//- $_DFF_N_ (D, C, Q) 576//- 577//- A negative edge D-type flip-flop. 578//- 579//- Truth table: D C | Q 580//- -----+--- 581//- d \ | d 582//- - - | q 583//- 584module \$_DFF_N_ (D, C, Q); 585input D, C; 586output reg Q; 587always @(negedge C) begin 588 Q <= D; 589end 590endmodule 591 592// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 593//- 594//- $_DFF_P_ (D, C, Q) 595//- 596//- A positive edge D-type flip-flop. 597//- 598//- Truth table: D C | Q 599//- -----+--- 600//- d / | d 601//- - - | q 602//- 603module \$_DFF_P_ (D, C, Q); 604input D, C; 605output reg Q; 606always @(posedge C) begin 607 Q <= D; 608end 609endmodule 610 611// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 612//- 613//- $_DFFE_NN_ (D, C, E, Q) 614//- 615//- A negative edge D-type flip-flop with negative polarity enable. 616//- 617//- Truth table: D C E | Q 618//- -------+--- 619//- d \ 0 | d 620//- - - - | q 621//- 622module \$_DFFE_NN_ (D, C, E, Q); 623input D, C, E; 624output reg Q; 625always @(negedge C) begin 626 if (!E) Q <= D; 627end 628endmodule 629 630// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 631//- 632//- $_DFFE_NP_ (D, C, E, Q) 633//- 634//- A negative edge D-type flip-flop with positive polarity enable. 635//- 636//- Truth table: D C E | Q 637//- -------+--- 638//- d \ 1 | d 639//- - - - | q 640//- 641module \$_DFFE_NP_ (D, C, E, Q); 642input D, C, E; 643output reg Q; 644always @(negedge C) begin 645 if (E) Q <= D; 646end 647endmodule 648 649// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 650//- 651//- $_DFFE_PN_ (D, C, E, Q) 652//- 653//- A positive edge D-type flip-flop with negative polarity enable. 654//- 655//- Truth table: D C E | Q 656//- -------+--- 657//- d / 0 | d 658//- - - - | q 659//- 660module \$_DFFE_PN_ (D, C, E, Q); 661input D, C, E; 662output reg Q; 663always @(posedge C) begin 664 if (!E) Q <= D; 665end 666endmodule 667 668// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 669//- 670//- $_DFFE_PP_ (D, C, E, Q) 671//- 672//- A positive edge D-type flip-flop with positive polarity enable. 673//- 674//- Truth table: D C E | Q 675//- -------+--- 676//- d / 1 | d 677//- - - - | q 678//- 679module \$_DFFE_PP_ (D, C, E, Q); 680input D, C, E; 681output reg Q; 682always @(posedge C) begin 683 if (E) Q <= D; 684end 685endmodule 686 687// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 688//- 689//- $_DFF_NN0_ (D, C, R, Q) 690//- 691//- A negative edge D-type flip-flop with negative polarity reset. 692//- 693//- Truth table: D C R | Q 694//- -------+--- 695//- - - 0 | 0 696//- d \ - | d 697//- - - - | q 698//- 699module \$_DFF_NN0_ (D, C, R, Q); 700input D, C, R; 701output reg Q; 702always @(negedge C or negedge R) begin 703 if (R == 0) 704 Q <= 0; 705 else 706 Q <= D; 707end 708endmodule 709 710// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 711//- 712//- $_DFF_NN1_ (D, C, R, Q) 713//- 714//- A negative edge D-type flip-flop with negative polarity set. 715//- 716//- Truth table: D C R | Q 717//- -------+--- 718//- - - 0 | 1 719//- d \ - | d 720//- - - - | q 721//- 722module \$_DFF_NN1_ (D, C, R, Q); 723input D, C, R; 724output reg Q; 725always @(negedge C or negedge R) begin 726 if (R == 0) 727 Q <= 1; 728 else 729 Q <= D; 730end 731endmodule 732 733// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 734//- 735//- $_DFF_NP0_ (D, C, R, Q) 736//- 737//- A negative edge D-type flip-flop with positive polarity reset. 738//- 739//- Truth table: D C R | Q 740//- -------+--- 741//- - - 1 | 0 742//- d \ - | d 743//- - - - | q 744//- 745module \$_DFF_NP0_ (D, C, R, Q); 746input D, C, R; 747output reg Q; 748always @(negedge C or posedge R) begin 749 if (R == 1) 750 Q <= 0; 751 else 752 Q <= D; 753end 754endmodule 755 756// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 757//- 758//- $_DFF_NP1_ (D, C, R, Q) 759//- 760//- A negative edge D-type flip-flop with positive polarity set. 761//- 762//- Truth table: D C R | Q 763//- -------+--- 764//- - - 1 | 1 765//- d \ - | d 766//- - - - | q 767//- 768module \$_DFF_NP1_ (D, C, R, Q); 769input D, C, R; 770output reg Q; 771always @(negedge C or posedge R) begin 772 if (R == 1) 773 Q <= 1; 774 else 775 Q <= D; 776end 777endmodule 778 779// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 780//- 781//- $_DFF_PN0_ (D, C, R, Q) 782//- 783//- A positive edge D-type flip-flop with negative polarity reset. 784//- 785//- Truth table: D C R | Q 786//- -------+--- 787//- - - 0 | 0 788//- d / - | d 789//- - - - | q 790//- 791module \$_DFF_PN0_ (D, C, R, Q); 792input D, C, R; 793output reg Q; 794always @(posedge C or negedge R) begin 795 if (R == 0) 796 Q <= 0; 797 else 798 Q <= D; 799end 800endmodule 801 802// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 803//- 804//- $_DFF_PN1_ (D, C, R, Q) 805//- 806//- A positive edge D-type flip-flop with negative polarity set. 807//- 808//- Truth table: D C R | Q 809//- -------+--- 810//- - - 0 | 1 811//- d / - | d 812//- - - - | q 813//- 814module \$_DFF_PN1_ (D, C, R, Q); 815input D, C, R; 816output reg Q; 817always @(posedge C or negedge R) begin 818 if (R == 0) 819 Q <= 1; 820 else 821 Q <= D; 822end 823endmodule 824 825// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 826//- 827//- $_DFF_PP0_ (D, C, R, Q) 828//- 829//- A positive edge D-type flip-flop with positive polarity reset. 830//- 831//- Truth table: D C R | Q 832//- -------+--- 833//- - - 1 | 0 834//- d / - | d 835//- - - - | q 836//- 837module \$_DFF_PP0_ (D, C, R, Q); 838input D, C, R; 839output reg Q; 840always @(posedge C or posedge R) begin 841 if (R == 1) 842 Q <= 0; 843 else 844 Q <= D; 845end 846endmodule 847 848// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 849//- 850//- $_DFF_PP1_ (D, C, R, Q) 851//- 852//- A positive edge D-type flip-flop with positive polarity set. 853//- 854//- Truth table: D C R | Q 855//- -------+--- 856//- - - 1 | 1 857//- d / - | d 858//- - - - | q 859//- 860module \$_DFF_PP1_ (D, C, R, Q); 861input D, C, R; 862output reg Q; 863always @(posedge C or posedge R) begin 864 if (R == 1) 865 Q <= 1; 866 else 867 Q <= D; 868end 869endmodule 870 871// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 872//- 873//- $_DFFE_NN0N_ (D, C, R, E, Q) 874//- 875//- A negative edge D-type flip-flop with negative polarity reset and negative 876//- polarity clock enable. 877//- 878//- Truth table: D C R E | Q 879//- ---------+--- 880//- - - 0 - | 0 881//- d \ - 0 | d 882//- - - - - | q 883//- 884module \$_DFFE_NN0N_ (D, C, R, E, Q); 885input D, C, R, E; 886output reg Q; 887always @(negedge C or negedge R) begin 888 if (R == 0) 889 Q <= 0; 890 else if (E == 0) 891 Q <= D; 892end 893endmodule 894 895// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 896//- 897//- $_DFFE_NN0P_ (D, C, R, E, Q) 898//- 899//- A negative edge D-type flip-flop with negative polarity reset and positive 900//- polarity clock enable. 901//- 902//- Truth table: D C R E | Q 903//- ---------+--- 904//- - - 0 - | 0 905//- d \ - 1 | d 906//- - - - - | q 907//- 908module \$_DFFE_NN0P_ (D, C, R, E, Q); 909input D, C, R, E; 910output reg Q; 911always @(negedge C or negedge R) begin 912 if (R == 0) 913 Q <= 0; 914 else if (E == 1) 915 Q <= D; 916end 917endmodule 918 919// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 920//- 921//- $_DFFE_NN1N_ (D, C, R, E, Q) 922//- 923//- A negative edge D-type flip-flop with negative polarity set and negative 924//- polarity clock enable. 925//- 926//- Truth table: D C R E | Q 927//- ---------+--- 928//- - - 0 - | 1 929//- d \ - 0 | d 930//- - - - - | q 931//- 932module \$_DFFE_NN1N_ (D, C, R, E, Q); 933input D, C, R, E; 934output reg Q; 935always @(negedge C or negedge R) begin 936 if (R == 0) 937 Q <= 1; 938 else if (E == 0) 939 Q <= D; 940end 941endmodule 942 943// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 944//- 945//- $_DFFE_NN1P_ (D, C, R, E, Q) 946//- 947//- A negative edge D-type flip-flop with negative polarity set and positive 948//- polarity clock enable. 949//- 950//- Truth table: D C R E | Q 951//- ---------+--- 952//- - - 0 - | 1 953//- d \ - 1 | d 954//- - - - - | q 955//- 956module \$_DFFE_NN1P_ (D, C, R, E, Q); 957input D, C, R, E; 958output reg Q; 959always @(negedge C or negedge R) begin 960 if (R == 0) 961 Q <= 1; 962 else if (E == 1) 963 Q <= D; 964end 965endmodule 966 967// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 968//- 969//- $_DFFE_NP0N_ (D, C, R, E, Q) 970//- 971//- A negative edge D-type flip-flop with positive polarity reset and negative 972//- polarity clock enable. 973//- 974//- Truth table: D C R E | Q 975//- ---------+--- 976//- - - 1 - | 0 977//- d \ - 0 | d 978//- - - - - | q 979//- 980module \$_DFFE_NP0N_ (D, C, R, E, Q); 981input D, C, R, E; 982output reg Q; 983always @(negedge C or posedge R) begin 984 if (R == 1) 985 Q <= 0; 986 else if (E == 0) 987 Q <= D; 988end 989endmodule 990 991// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 992//- 993//- $_DFFE_NP0P_ (D, C, R, E, Q) 994//- 995//- A negative edge D-type flip-flop with positive polarity reset and positive 996//- polarity clock enable. 997//- 998//- Truth table: D C R E | Q 999//- ---------+--- 1000//- - - 1 - | 0 1001//- d \ - 1 | d 1002//- - - - - | q 1003//- 1004module \$_DFFE_NP0P_ (D, C, R, E, Q); 1005input D, C, R, E; 1006output reg Q; 1007always @(negedge C or posedge R) begin 1008 if (R == 1) 1009 Q <= 0; 1010 else if (E == 1) 1011 Q <= D; 1012end 1013endmodule 1014 1015// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1016//- 1017//- $_DFFE_NP1N_ (D, C, R, E, Q) 1018//- 1019//- A negative edge D-type flip-flop with positive polarity set and negative 1020//- polarity clock enable. 1021//- 1022//- Truth table: D C R E | Q 1023//- ---------+--- 1024//- - - 1 - | 1 1025//- d \ - 0 | d 1026//- - - - - | q 1027//- 1028module \$_DFFE_NP1N_ (D, C, R, E, Q); 1029input D, C, R, E; 1030output reg Q; 1031always @(negedge C or posedge R) begin 1032 if (R == 1) 1033 Q <= 1; 1034 else if (E == 0) 1035 Q <= D; 1036end 1037endmodule 1038 1039// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1040//- 1041//- $_DFFE_NP1P_ (D, C, R, E, Q) 1042//- 1043//- A negative edge D-type flip-flop with positive polarity set and positive 1044//- polarity clock enable. 1045//- 1046//- Truth table: D C R E | Q 1047//- ---------+--- 1048//- - - 1 - | 1 1049//- d \ - 1 | d 1050//- - - - - | q 1051//- 1052module \$_DFFE_NP1P_ (D, C, R, E, Q); 1053input D, C, R, E; 1054output reg Q; 1055always @(negedge C or posedge R) begin 1056 if (R == 1) 1057 Q <= 1; 1058 else if (E == 1) 1059 Q <= D; 1060end 1061endmodule 1062 1063// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1064//- 1065//- $_DFFE_PN0N_ (D, C, R, E, Q) 1066//- 1067//- A positive edge D-type flip-flop with negative polarity reset and negative 1068//- polarity clock enable. 1069//- 1070//- Truth table: D C R E | Q 1071//- ---------+--- 1072//- - - 0 - | 0 1073//- d / - 0 | d 1074//- - - - - | q 1075//- 1076module \$_DFFE_PN0N_ (D, C, R, E, Q); 1077input D, C, R, E; 1078output reg Q; 1079always @(posedge C or negedge R) begin 1080 if (R == 0) 1081 Q <= 0; 1082 else if (E == 0) 1083 Q <= D; 1084end 1085endmodule 1086 1087// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1088//- 1089//- $_DFFE_PN0P_ (D, C, R, E, Q) 1090//- 1091//- A positive edge D-type flip-flop with negative polarity reset and positive 1092//- polarity clock enable. 1093//- 1094//- Truth table: D C R E | Q 1095//- ---------+--- 1096//- - - 0 - | 0 1097//- d / - 1 | d 1098//- - - - - | q 1099//- 1100module \$_DFFE_PN0P_ (D, C, R, E, Q); 1101input D, C, R, E; 1102output reg Q; 1103always @(posedge C or negedge R) begin 1104 if (R == 0) 1105 Q <= 0; 1106 else if (E == 1) 1107 Q <= D; 1108end 1109endmodule 1110 1111// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1112//- 1113//- $_DFFE_PN1N_ (D, C, R, E, Q) 1114//- 1115//- A positive edge D-type flip-flop with negative polarity set and negative 1116//- polarity clock enable. 1117//- 1118//- Truth table: D C R E | Q 1119//- ---------+--- 1120//- - - 0 - | 1 1121//- d / - 0 | d 1122//- - - - - | q 1123//- 1124module \$_DFFE_PN1N_ (D, C, R, E, Q); 1125input D, C, R, E; 1126output reg Q; 1127always @(posedge C or negedge R) begin 1128 if (R == 0) 1129 Q <= 1; 1130 else if (E == 0) 1131 Q <= D; 1132end 1133endmodule 1134 1135// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1136//- 1137//- $_DFFE_PN1P_ (D, C, R, E, Q) 1138//- 1139//- A positive edge D-type flip-flop with negative polarity set and positive 1140//- polarity clock enable. 1141//- 1142//- Truth table: D C R E | Q 1143//- ---------+--- 1144//- - - 0 - | 1 1145//- d / - 1 | d 1146//- - - - - | q 1147//- 1148module \$_DFFE_PN1P_ (D, C, R, E, Q); 1149input D, C, R, E; 1150output reg Q; 1151always @(posedge C or negedge R) begin 1152 if (R == 0) 1153 Q <= 1; 1154 else if (E == 1) 1155 Q <= D; 1156end 1157endmodule 1158 1159// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1160//- 1161//- $_DFFE_PP0N_ (D, C, R, E, Q) 1162//- 1163//- A positive edge D-type flip-flop with positive polarity reset and negative 1164//- polarity clock enable. 1165//- 1166//- Truth table: D C R E | Q 1167//- ---------+--- 1168//- - - 1 - | 0 1169//- d / - 0 | d 1170//- - - - - | q 1171//- 1172module \$_DFFE_PP0N_ (D, C, R, E, Q); 1173input D, C, R, E; 1174output reg Q; 1175always @(posedge C or posedge R) begin 1176 if (R == 1) 1177 Q <= 0; 1178 else if (E == 0) 1179 Q <= D; 1180end 1181endmodule 1182 1183// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1184//- 1185//- $_DFFE_PP0P_ (D, C, R, E, Q) 1186//- 1187//- A positive edge D-type flip-flop with positive polarity reset and positive 1188//- polarity clock enable. 1189//- 1190//- Truth table: D C R E | Q 1191//- ---------+--- 1192//- - - 1 - | 0 1193//- d / - 1 | d 1194//- - - - - | q 1195//- 1196module \$_DFFE_PP0P_ (D, C, R, E, Q); 1197input D, C, R, E; 1198output reg Q; 1199always @(posedge C or posedge R) begin 1200 if (R == 1) 1201 Q <= 0; 1202 else if (E == 1) 1203 Q <= D; 1204end 1205endmodule 1206 1207// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1208//- 1209//- $_DFFE_PP1N_ (D, C, R, E, Q) 1210//- 1211//- A positive edge D-type flip-flop with positive polarity set and negative 1212//- polarity clock enable. 1213//- 1214//- Truth table: D C R E | Q 1215//- ---------+--- 1216//- - - 1 - | 1 1217//- d / - 0 | d 1218//- - - - - | q 1219//- 1220module \$_DFFE_PP1N_ (D, C, R, E, Q); 1221input D, C, R, E; 1222output reg Q; 1223always @(posedge C or posedge R) begin 1224 if (R == 1) 1225 Q <= 1; 1226 else if (E == 0) 1227 Q <= D; 1228end 1229endmodule 1230 1231// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1232//- 1233//- $_DFFE_PP1P_ (D, C, R, E, Q) 1234//- 1235//- A positive edge D-type flip-flop with positive polarity set and positive 1236//- polarity clock enable. 1237//- 1238//- Truth table: D C R E | Q 1239//- ---------+--- 1240//- - - 1 - | 1 1241//- d / - 1 | d 1242//- - - - - | q 1243//- 1244module \$_DFFE_PP1P_ (D, C, R, E, Q); 1245input D, C, R, E; 1246output reg Q; 1247always @(posedge C or posedge R) begin 1248 if (R == 1) 1249 Q <= 1; 1250 else if (E == 1) 1251 Q <= D; 1252end 1253endmodule 1254 1255// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1256//- 1257//- $_ALDFF_NN_ (D, C, L, AD, Q) 1258//- 1259//- A negative edge D-type flip-flop with negative polarity async load. 1260//- 1261//- Truth table: D C L AD | Q 1262//- ----------+--- 1263//- - - 0 a | a 1264//- d \ - - | d 1265//- - - - - | q 1266//- 1267module \$_ALDFF_NN_ (D, C, L, AD, Q); 1268input D, C, L, AD; 1269output reg Q; 1270always @(negedge C or negedge L) begin 1271 if (L == 0) 1272 Q <= AD; 1273 else 1274 Q <= D; 1275end 1276endmodule 1277 1278// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1279//- 1280//- $_ALDFF_NP_ (D, C, L, AD, Q) 1281//- 1282//- A negative edge D-type flip-flop with positive polarity async load. 1283//- 1284//- Truth table: D C L AD | Q 1285//- ----------+--- 1286//- - - 1 a | a 1287//- d \ - - | d 1288//- - - - - | q 1289//- 1290module \$_ALDFF_NP_ (D, C, L, AD, Q); 1291input D, C, L, AD; 1292output reg Q; 1293always @(negedge C or posedge L) begin 1294 if (L == 1) 1295 Q <= AD; 1296 else 1297 Q <= D; 1298end 1299endmodule 1300 1301// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1302//- 1303//- $_ALDFF_PN_ (D, C, L, AD, Q) 1304//- 1305//- A positive edge D-type flip-flop with negative polarity async load. 1306//- 1307//- Truth table: D C L AD | Q 1308//- ----------+--- 1309//- - - 0 a | a 1310//- d / - - | d 1311//- - - - - | q 1312//- 1313module \$_ALDFF_PN_ (D, C, L, AD, Q); 1314input D, C, L, AD; 1315output reg Q; 1316always @(posedge C or negedge L) begin 1317 if (L == 0) 1318 Q <= AD; 1319 else 1320 Q <= D; 1321end 1322endmodule 1323 1324// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1325//- 1326//- $_ALDFF_PP_ (D, C, L, AD, Q) 1327//- 1328//- A positive edge D-type flip-flop with positive polarity async load. 1329//- 1330//- Truth table: D C L AD | Q 1331//- ----------+--- 1332//- - - 1 a | a 1333//- d / - - | d 1334//- - - - - | q 1335//- 1336module \$_ALDFF_PP_ (D, C, L, AD, Q); 1337input D, C, L, AD; 1338output reg Q; 1339always @(posedge C or posedge L) begin 1340 if (L == 1) 1341 Q <= AD; 1342 else 1343 Q <= D; 1344end 1345endmodule 1346 1347// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1348//- 1349//- $_ALDFFE_NNN_ (D, C, L, AD, E, Q) 1350//- 1351//- A negative edge D-type flip-flop with negative polarity async load and negative 1352//- polarity clock enable. 1353//- 1354//- Truth table: D C L AD E | Q 1355//- ------------+--- 1356//- - - 0 a - | a 1357//- d \ - - 0 | d 1358//- - - - - - | q 1359//- 1360module \$_ALDFFE_NNN_ (D, C, L, AD, E, Q); 1361input D, C, L, AD, E; 1362output reg Q; 1363always @(negedge C or negedge L) begin 1364 if (L == 0) 1365 Q <= AD; 1366 else if (E == 0) 1367 Q <= D; 1368end 1369endmodule 1370 1371// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1372//- 1373//- $_ALDFFE_NNP_ (D, C, L, AD, E, Q) 1374//- 1375//- A negative edge D-type flip-flop with negative polarity async load and positive 1376//- polarity clock enable. 1377//- 1378//- Truth table: D C L AD E | Q 1379//- ------------+--- 1380//- - - 0 a - | a 1381//- d \ - - 1 | d 1382//- - - - - - | q 1383//- 1384module \$_ALDFFE_NNP_ (D, C, L, AD, E, Q); 1385input D, C, L, AD, E; 1386output reg Q; 1387always @(negedge C or negedge L) begin 1388 if (L == 0) 1389 Q <= AD; 1390 else if (E == 1) 1391 Q <= D; 1392end 1393endmodule 1394 1395// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1396//- 1397//- $_ALDFFE_NPN_ (D, C, L, AD, E, Q) 1398//- 1399//- A negative edge D-type flip-flop with positive polarity async load and negative 1400//- polarity clock enable. 1401//- 1402//- Truth table: D C L AD E | Q 1403//- ------------+--- 1404//- - - 1 a - | a 1405//- d \ - - 0 | d 1406//- - - - - - | q 1407//- 1408module \$_ALDFFE_NPN_ (D, C, L, AD, E, Q); 1409input D, C, L, AD, E; 1410output reg Q; 1411always @(negedge C or posedge L) begin 1412 if (L == 1) 1413 Q <= AD; 1414 else if (E == 0) 1415 Q <= D; 1416end 1417endmodule 1418 1419// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1420//- 1421//- $_ALDFFE_NPP_ (D, C, L, AD, E, Q) 1422//- 1423//- A negative edge D-type flip-flop with positive polarity async load and positive 1424//- polarity clock enable. 1425//- 1426//- Truth table: D C L AD E | Q 1427//- ------------+--- 1428//- - - 1 a - | a 1429//- d \ - - 1 | d 1430//- - - - - - | q 1431//- 1432module \$_ALDFFE_NPP_ (D, C, L, AD, E, Q); 1433input D, C, L, AD, E; 1434output reg Q; 1435always @(negedge C or posedge L) begin 1436 if (L == 1) 1437 Q <= AD; 1438 else if (E == 1) 1439 Q <= D; 1440end 1441endmodule 1442 1443// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1444//- 1445//- $_ALDFFE_PNN_ (D, C, L, AD, E, Q) 1446//- 1447//- A positive edge D-type flip-flop with negative polarity async load and negative 1448//- polarity clock enable. 1449//- 1450//- Truth table: D C L AD E | Q 1451//- ------------+--- 1452//- - - 0 a - | a 1453//- d / - - 0 | d 1454//- - - - - - | q 1455//- 1456module \$_ALDFFE_PNN_ (D, C, L, AD, E, Q); 1457input D, C, L, AD, E; 1458output reg Q; 1459always @(posedge C or negedge L) begin 1460 if (L == 0) 1461 Q <= AD; 1462 else if (E == 0) 1463 Q <= D; 1464end 1465endmodule 1466 1467// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1468//- 1469//- $_ALDFFE_PNP_ (D, C, L, AD, E, Q) 1470//- 1471//- A positive edge D-type flip-flop with negative polarity async load and positive 1472//- polarity clock enable. 1473//- 1474//- Truth table: D C L AD E | Q 1475//- ------------+--- 1476//- - - 0 a - | a 1477//- d / - - 1 | d 1478//- - - - - - | q 1479//- 1480module \$_ALDFFE_PNP_ (D, C, L, AD, E, Q); 1481input D, C, L, AD, E; 1482output reg Q; 1483always @(posedge C or negedge L) begin 1484 if (L == 0) 1485 Q <= AD; 1486 else if (E == 1) 1487 Q <= D; 1488end 1489endmodule 1490 1491// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1492//- 1493//- $_ALDFFE_PPN_ (D, C, L, AD, E, Q) 1494//- 1495//- A positive edge D-type flip-flop with positive polarity async load and negative 1496//- polarity clock enable. 1497//- 1498//- Truth table: D C L AD E | Q 1499//- ------------+--- 1500//- - - 1 a - | a 1501//- d / - - 0 | d 1502//- - - - - - | q 1503//- 1504module \$_ALDFFE_PPN_ (D, C, L, AD, E, Q); 1505input D, C, L, AD, E; 1506output reg Q; 1507always @(posedge C or posedge L) begin 1508 if (L == 1) 1509 Q <= AD; 1510 else if (E == 0) 1511 Q <= D; 1512end 1513endmodule 1514 1515// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1516//- 1517//- $_ALDFFE_PPP_ (D, C, L, AD, E, Q) 1518//- 1519//- A positive edge D-type flip-flop with positive polarity async load and positive 1520//- polarity clock enable. 1521//- 1522//- Truth table: D C L AD E | Q 1523//- ------------+--- 1524//- - - 1 a - | a 1525//- d / - - 1 | d 1526//- - - - - - | q 1527//- 1528module \$_ALDFFE_PPP_ (D, C, L, AD, E, Q); 1529input D, C, L, AD, E; 1530output reg Q; 1531always @(posedge C or posedge L) begin 1532 if (L == 1) 1533 Q <= AD; 1534 else if (E == 1) 1535 Q <= D; 1536end 1537endmodule 1538 1539// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1540//- 1541//- $_DFFSR_NNN_ (C, S, R, D, Q) 1542//- 1543//- A negative edge D-type flip-flop with negative polarity set and negative 1544//- polarity reset. 1545//- 1546//- Truth table: C S R D | Q 1547//- ---------+--- 1548//- - - 0 - | 0 1549//- - 0 - - | 1 1550//- \ - - d | d 1551//- - - - - | q 1552//- 1553module \$_DFFSR_NNN_ (C, S, R, D, Q); 1554input C, S, R, D; 1555output reg Q; 1556always @(negedge C, negedge S, negedge R) begin 1557 if (R == 0) 1558 Q <= 0; 1559 else if (S == 0) 1560 Q <= 1; 1561 else 1562 Q <= D; 1563end 1564endmodule 1565 1566// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1567//- 1568//- $_DFFSR_NNP_ (C, S, R, D, Q) 1569//- 1570//- A negative edge D-type flip-flop with negative polarity set and positive 1571//- polarity reset. 1572//- 1573//- Truth table: C S R D | Q 1574//- ---------+--- 1575//- - - 1 - | 0 1576//- - 0 - - | 1 1577//- \ - - d | d 1578//- - - - - | q 1579//- 1580module \$_DFFSR_NNP_ (C, S, R, D, Q); 1581input C, S, R, D; 1582output reg Q; 1583always @(negedge C, negedge S, posedge R) begin 1584 if (R == 1) 1585 Q <= 0; 1586 else if (S == 0) 1587 Q <= 1; 1588 else 1589 Q <= D; 1590end 1591endmodule 1592 1593// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1594//- 1595//- $_DFFSR_NPN_ (C, S, R, D, Q) 1596//- 1597//- A negative edge D-type flip-flop with positive polarity set and negative 1598//- polarity reset. 1599//- 1600//- Truth table: C S R D | Q 1601//- ---------+--- 1602//- - - 0 - | 0 1603//- - 1 - - | 1 1604//- \ - - d | d 1605//- - - - - | q 1606//- 1607module \$_DFFSR_NPN_ (C, S, R, D, Q); 1608input C, S, R, D; 1609output reg Q; 1610always @(negedge C, posedge S, negedge R) begin 1611 if (R == 0) 1612 Q <= 0; 1613 else if (S == 1) 1614 Q <= 1; 1615 else 1616 Q <= D; 1617end 1618endmodule 1619 1620// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1621//- 1622//- $_DFFSR_NPP_ (C, S, R, D, Q) 1623//- 1624//- A negative edge D-type flip-flop with positive polarity set and positive 1625//- polarity reset. 1626//- 1627//- Truth table: C S R D | Q 1628//- ---------+--- 1629//- - - 1 - | 0 1630//- - 1 - - | 1 1631//- \ - - d | d 1632//- - - - - | q 1633//- 1634module \$_DFFSR_NPP_ (C, S, R, D, Q); 1635input C, S, R, D; 1636output reg Q; 1637always @(negedge C, posedge S, posedge R) begin 1638 if (R == 1) 1639 Q <= 0; 1640 else if (S == 1) 1641 Q <= 1; 1642 else 1643 Q <= D; 1644end 1645endmodule 1646 1647// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1648//- 1649//- $_DFFSR_PNN_ (C, S, R, D, Q) 1650//- 1651//- A positive edge D-type flip-flop with negative polarity set and negative 1652//- polarity reset. 1653//- 1654//- Truth table: C S R D | Q 1655//- ---------+--- 1656//- - - 0 - | 0 1657//- - 0 - - | 1 1658//- / - - d | d 1659//- - - - - | q 1660//- 1661module \$_DFFSR_PNN_ (C, S, R, D, Q); 1662input C, S, R, D; 1663output reg Q; 1664always @(posedge C, negedge S, negedge R) begin 1665 if (R == 0) 1666 Q <= 0; 1667 else if (S == 0) 1668 Q <= 1; 1669 else 1670 Q <= D; 1671end 1672endmodule 1673 1674// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1675//- 1676//- $_DFFSR_PNP_ (C, S, R, D, Q) 1677//- 1678//- A positive edge D-type flip-flop with negative polarity set and positive 1679//- polarity reset. 1680//- 1681//- Truth table: C S R D | Q 1682//- ---------+--- 1683//- - - 1 - | 0 1684//- - 0 - - | 1 1685//- / - - d | d 1686//- - - - - | q 1687//- 1688module \$_DFFSR_PNP_ (C, S, R, D, Q); 1689input C, S, R, D; 1690output reg Q; 1691always @(posedge C, negedge S, posedge R) begin 1692 if (R == 1) 1693 Q <= 0; 1694 else if (S == 0) 1695 Q <= 1; 1696 else 1697 Q <= D; 1698end 1699endmodule 1700 1701// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1702//- 1703//- $_DFFSR_PPN_ (C, S, R, D, Q) 1704//- 1705//- A positive edge D-type flip-flop with positive polarity set and negative 1706//- polarity reset. 1707//- 1708//- Truth table: C S R D | Q 1709//- ---------+--- 1710//- - - 0 - | 0 1711//- - 1 - - | 1 1712//- / - - d | d 1713//- - - - - | q 1714//- 1715module \$_DFFSR_PPN_ (C, S, R, D, Q); 1716input C, S, R, D; 1717output reg Q; 1718always @(posedge C, posedge S, negedge R) begin 1719 if (R == 0) 1720 Q <= 0; 1721 else if (S == 1) 1722 Q <= 1; 1723 else 1724 Q <= D; 1725end 1726endmodule 1727 1728// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1729//- 1730//- $_DFFSR_PPP_ (C, S, R, D, Q) 1731//- 1732//- A positive edge D-type flip-flop with positive polarity set and positive 1733//- polarity reset. 1734//- 1735//- Truth table: C S R D | Q 1736//- ---------+--- 1737//- - - 1 - | 0 1738//- - 1 - - | 1 1739//- / - - d | d 1740//- - - - - | q 1741//- 1742module \$_DFFSR_PPP_ (C, S, R, D, Q); 1743input C, S, R, D; 1744output reg Q; 1745always @(posedge C, posedge S, posedge R) begin 1746 if (R == 1) 1747 Q <= 0; 1748 else if (S == 1) 1749 Q <= 1; 1750 else 1751 Q <= D; 1752end 1753endmodule 1754 1755// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1756//- 1757//- $_DFFSRE_NNNN_ (C, S, R, E, D, Q) 1758//- 1759//- A negative edge D-type flip-flop with negative polarity set, negative 1760//- polarity reset and negative polarity clock enable. 1761//- 1762//- Truth table: C S R E D | Q 1763//- -----------+--- 1764//- - - 0 - - | 0 1765//- - 0 - - - | 1 1766//- \ - - 0 d | d 1767//- - - - - - | q 1768//- 1769module \$_DFFSRE_NNNN_ (C, S, R, E, D, Q); 1770input C, S, R, E, D; 1771output reg Q; 1772always @(negedge C, negedge S, negedge R) begin 1773 if (R == 0) 1774 Q <= 0; 1775 else if (S == 0) 1776 Q <= 1; 1777 else if (E == 0) 1778 Q <= D; 1779end 1780endmodule 1781 1782// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1783//- 1784//- $_DFFSRE_NNNP_ (C, S, R, E, D, Q) 1785//- 1786//- A negative edge D-type flip-flop with negative polarity set, negative 1787//- polarity reset and positive polarity clock enable. 1788//- 1789//- Truth table: C S R E D | Q 1790//- -----------+--- 1791//- - - 0 - - | 0 1792//- - 0 - - - | 1 1793//- \ - - 1 d | d 1794//- - - - - - | q 1795//- 1796module \$_DFFSRE_NNNP_ (C, S, R, E, D, Q); 1797input C, S, R, E, D; 1798output reg Q; 1799always @(negedge C, negedge S, negedge R) begin 1800 if (R == 0) 1801 Q <= 0; 1802 else if (S == 0) 1803 Q <= 1; 1804 else if (E == 1) 1805 Q <= D; 1806end 1807endmodule 1808 1809// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1810//- 1811//- $_DFFSRE_NNPN_ (C, S, R, E, D, Q) 1812//- 1813//- A negative edge D-type flip-flop with negative polarity set, positive 1814//- polarity reset and negative polarity clock enable. 1815//- 1816//- Truth table: C S R E D | Q 1817//- -----------+--- 1818//- - - 1 - - | 0 1819//- - 0 - - - | 1 1820//- \ - - 0 d | d 1821//- - - - - - | q 1822//- 1823module \$_DFFSRE_NNPN_ (C, S, R, E, D, Q); 1824input C, S, R, E, D; 1825output reg Q; 1826always @(negedge C, negedge S, posedge R) begin 1827 if (R == 1) 1828 Q <= 0; 1829 else if (S == 0) 1830 Q <= 1; 1831 else if (E == 0) 1832 Q <= D; 1833end 1834endmodule 1835 1836// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1837//- 1838//- $_DFFSRE_NNPP_ (C, S, R, E, D, Q) 1839//- 1840//- A negative edge D-type flip-flop with negative polarity set, positive 1841//- polarity reset and positive polarity clock enable. 1842//- 1843//- Truth table: C S R E D | Q 1844//- -----------+--- 1845//- - - 1 - - | 0 1846//- - 0 - - - | 1 1847//- \ - - 1 d | d 1848//- - - - - - | q 1849//- 1850module \$_DFFSRE_NNPP_ (C, S, R, E, D, Q); 1851input C, S, R, E, D; 1852output reg Q; 1853always @(negedge C, negedge S, posedge R) begin 1854 if (R == 1) 1855 Q <= 0; 1856 else if (S == 0) 1857 Q <= 1; 1858 else if (E == 1) 1859 Q <= D; 1860end 1861endmodule 1862 1863// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1864//- 1865//- $_DFFSRE_NPNN_ (C, S, R, E, D, Q) 1866//- 1867//- A negative edge D-type flip-flop with positive polarity set, negative 1868//- polarity reset and negative polarity clock enable. 1869//- 1870//- Truth table: C S R E D | Q 1871//- -----------+--- 1872//- - - 0 - - | 0 1873//- - 1 - - - | 1 1874//- \ - - 0 d | d 1875//- - - - - - | q 1876//- 1877module \$_DFFSRE_NPNN_ (C, S, R, E, D, Q); 1878input C, S, R, E, D; 1879output reg Q; 1880always @(negedge C, posedge S, negedge R) begin 1881 if (R == 0) 1882 Q <= 0; 1883 else if (S == 1) 1884 Q <= 1; 1885 else if (E == 0) 1886 Q <= D; 1887end 1888endmodule 1889 1890// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1891//- 1892//- $_DFFSRE_NPNP_ (C, S, R, E, D, Q) 1893//- 1894//- A negative edge D-type flip-flop with positive polarity set, negative 1895//- polarity reset and positive polarity clock enable. 1896//- 1897//- Truth table: C S R E D | Q 1898//- -----------+--- 1899//- - - 0 - - | 0 1900//- - 1 - - - | 1 1901//- \ - - 1 d | d 1902//- - - - - - | q 1903//- 1904module \$_DFFSRE_NPNP_ (C, S, R, E, D, Q); 1905input C, S, R, E, D; 1906output reg Q; 1907always @(negedge C, posedge S, negedge R) begin 1908 if (R == 0) 1909 Q <= 0; 1910 else if (S == 1) 1911 Q <= 1; 1912 else if (E == 1) 1913 Q <= D; 1914end 1915endmodule 1916 1917// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1918//- 1919//- $_DFFSRE_NPPN_ (C, S, R, E, D, Q) 1920//- 1921//- A negative edge D-type flip-flop with positive polarity set, positive 1922//- polarity reset and negative polarity clock enable. 1923//- 1924//- Truth table: C S R E D | Q 1925//- -----------+--- 1926//- - - 1 - - | 0 1927//- - 1 - - - | 1 1928//- \ - - 0 d | d 1929//- - - - - - | q 1930//- 1931module \$_DFFSRE_NPPN_ (C, S, R, E, D, Q); 1932input C, S, R, E, D; 1933output reg Q; 1934always @(negedge C, posedge S, posedge R) begin 1935 if (R == 1) 1936 Q <= 0; 1937 else if (S == 1) 1938 Q <= 1; 1939 else if (E == 0) 1940 Q <= D; 1941end 1942endmodule 1943 1944// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1945//- 1946//- $_DFFSRE_NPPP_ (C, S, R, E, D, Q) 1947//- 1948//- A negative edge D-type flip-flop with positive polarity set, positive 1949//- polarity reset and positive polarity clock enable. 1950//- 1951//- Truth table: C S R E D | Q 1952//- -----------+--- 1953//- - - 1 - - | 0 1954//- - 1 - - - | 1 1955//- \ - - 1 d | d 1956//- - - - - - | q 1957//- 1958module \$_DFFSRE_NPPP_ (C, S, R, E, D, Q); 1959input C, S, R, E, D; 1960output reg Q; 1961always @(negedge C, posedge S, posedge R) begin 1962 if (R == 1) 1963 Q <= 0; 1964 else if (S == 1) 1965 Q <= 1; 1966 else if (E == 1) 1967 Q <= D; 1968end 1969endmodule 1970 1971// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1972//- 1973//- $_DFFSRE_PNNN_ (C, S, R, E, D, Q) 1974//- 1975//- A positive edge D-type flip-flop with negative polarity set, negative 1976//- polarity reset and negative polarity clock enable. 1977//- 1978//- Truth table: C S R E D | Q 1979//- -----------+--- 1980//- - - 0 - - | 0 1981//- - 0 - - - | 1 1982//- / - - 0 d | d 1983//- - - - - - | q 1984//- 1985module \$_DFFSRE_PNNN_ (C, S, R, E, D, Q); 1986input C, S, R, E, D; 1987output reg Q; 1988always @(posedge C, negedge S, negedge R) begin 1989 if (R == 0) 1990 Q <= 0; 1991 else if (S == 0) 1992 Q <= 1; 1993 else if (E == 0) 1994 Q <= D; 1995end 1996endmodule 1997 1998// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 1999//- 2000//- $_DFFSRE_PNNP_ (C, S, R, E, D, Q) 2001//- 2002//- A positive edge D-type flip-flop with negative polarity set, negative 2003//- polarity reset and positive polarity clock enable. 2004//- 2005//- Truth table: C S R E D | Q 2006//- -----------+--- 2007//- - - 0 - - | 0 2008//- - 0 - - - | 1 2009//- / - - 1 d | d 2010//- - - - - - | q 2011//- 2012module \$_DFFSRE_PNNP_ (C, S, R, E, D, Q); 2013input C, S, R, E, D; 2014output reg Q; 2015always @(posedge C, negedge S, negedge R) begin 2016 if (R == 0) 2017 Q <= 0; 2018 else if (S == 0) 2019 Q <= 1; 2020 else if (E == 1) 2021 Q <= D; 2022end 2023endmodule 2024 2025// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2026//- 2027//- $_DFFSRE_PNPN_ (C, S, R, E, D, Q) 2028//- 2029//- A positive edge D-type flip-flop with negative polarity set, positive 2030//- polarity reset and negative polarity clock enable. 2031//- 2032//- Truth table: C S R E D | Q 2033//- -----------+--- 2034//- - - 1 - - | 0 2035//- - 0 - - - | 1 2036//- / - - 0 d | d 2037//- - - - - - | q 2038//- 2039module \$_DFFSRE_PNPN_ (C, S, R, E, D, Q); 2040input C, S, R, E, D; 2041output reg Q; 2042always @(posedge C, negedge S, posedge R) begin 2043 if (R == 1) 2044 Q <= 0; 2045 else if (S == 0) 2046 Q <= 1; 2047 else if (E == 0) 2048 Q <= D; 2049end 2050endmodule 2051 2052// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2053//- 2054//- $_DFFSRE_PNPP_ (C, S, R, E, D, Q) 2055//- 2056//- A positive edge D-type flip-flop with negative polarity set, positive 2057//- polarity reset and positive polarity clock enable. 2058//- 2059//- Truth table: C S R E D | Q 2060//- -----------+--- 2061//- - - 1 - - | 0 2062//- - 0 - - - | 1 2063//- / - - 1 d | d 2064//- - - - - - | q 2065//- 2066module \$_DFFSRE_PNPP_ (C, S, R, E, D, Q); 2067input C, S, R, E, D; 2068output reg Q; 2069always @(posedge C, negedge S, posedge R) begin 2070 if (R == 1) 2071 Q <= 0; 2072 else if (S == 0) 2073 Q <= 1; 2074 else if (E == 1) 2075 Q <= D; 2076end 2077endmodule 2078 2079// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2080//- 2081//- $_DFFSRE_PPNN_ (C, S, R, E, D, Q) 2082//- 2083//- A positive edge D-type flip-flop with positive polarity set, negative 2084//- polarity reset and negative polarity clock enable. 2085//- 2086//- Truth table: C S R E D | Q 2087//- -----------+--- 2088//- - - 0 - - | 0 2089//- - 1 - - - | 1 2090//- / - - 0 d | d 2091//- - - - - - | q 2092//- 2093module \$_DFFSRE_PPNN_ (C, S, R, E, D, Q); 2094input C, S, R, E, D; 2095output reg Q; 2096always @(posedge C, posedge S, negedge R) begin 2097 if (R == 0) 2098 Q <= 0; 2099 else if (S == 1) 2100 Q <= 1; 2101 else if (E == 0) 2102 Q <= D; 2103end 2104endmodule 2105 2106// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2107//- 2108//- $_DFFSRE_PPNP_ (C, S, R, E, D, Q) 2109//- 2110//- A positive edge D-type flip-flop with positive polarity set, negative 2111//- polarity reset and positive polarity clock enable. 2112//- 2113//- Truth table: C S R E D | Q 2114//- -----------+--- 2115//- - - 0 - - | 0 2116//- - 1 - - - | 1 2117//- / - - 1 d | d 2118//- - - - - - | q 2119//- 2120module \$_DFFSRE_PPNP_ (C, S, R, E, D, Q); 2121input C, S, R, E, D; 2122output reg Q; 2123always @(posedge C, posedge S, negedge R) begin 2124 if (R == 0) 2125 Q <= 0; 2126 else if (S == 1) 2127 Q <= 1; 2128 else if (E == 1) 2129 Q <= D; 2130end 2131endmodule 2132 2133// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2134//- 2135//- $_DFFSRE_PPPN_ (C, S, R, E, D, Q) 2136//- 2137//- A positive edge D-type flip-flop with positive polarity set, positive 2138//- polarity reset and negative polarity clock enable. 2139//- 2140//- Truth table: C S R E D | Q 2141//- -----------+--- 2142//- - - 1 - - | 0 2143//- - 1 - - - | 1 2144//- / - - 0 d | d 2145//- - - - - - | q 2146//- 2147module \$_DFFSRE_PPPN_ (C, S, R, E, D, Q); 2148input C, S, R, E, D; 2149output reg Q; 2150always @(posedge C, posedge S, posedge R) begin 2151 if (R == 1) 2152 Q <= 0; 2153 else if (S == 1) 2154 Q <= 1; 2155 else if (E == 0) 2156 Q <= D; 2157end 2158endmodule 2159 2160// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2161//- 2162//- $_DFFSRE_PPPP_ (C, S, R, E, D, Q) 2163//- 2164//- A positive edge D-type flip-flop with positive polarity set, positive 2165//- polarity reset and positive polarity clock enable. 2166//- 2167//- Truth table: C S R E D | Q 2168//- -----------+--- 2169//- - - 1 - - | 0 2170//- - 1 - - - | 1 2171//- / - - 1 d | d 2172//- - - - - - | q 2173//- 2174module \$_DFFSRE_PPPP_ (C, S, R, E, D, Q); 2175input C, S, R, E, D; 2176output reg Q; 2177always @(posedge C, posedge S, posedge R) begin 2178 if (R == 1) 2179 Q <= 0; 2180 else if (S == 1) 2181 Q <= 1; 2182 else if (E == 1) 2183 Q <= D; 2184end 2185endmodule 2186 2187// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2188//- 2189//- $_SDFF_NN0_ (D, C, R, Q) 2190//- 2191//- A negative edge D-type flip-flop with negative polarity synchronous reset. 2192//- 2193//- Truth table: D C R | Q 2194//- -------+--- 2195//- - \ 0 | 0 2196//- d \ - | d 2197//- - - - | q 2198//- 2199module \$_SDFF_NN0_ (D, C, R, Q); 2200input D, C, R; 2201output reg Q; 2202always @(negedge C) begin 2203 if (R == 0) 2204 Q <= 0; 2205 else 2206 Q <= D; 2207end 2208endmodule 2209 2210// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2211//- 2212//- $_SDFF_NN1_ (D, C, R, Q) 2213//- 2214//- A negative edge D-type flip-flop with negative polarity synchronous set. 2215//- 2216//- Truth table: D C R | Q 2217//- -------+--- 2218//- - \ 0 | 1 2219//- d \ - | d 2220//- - - - | q 2221//- 2222module \$_SDFF_NN1_ (D, C, R, Q); 2223input D, C, R; 2224output reg Q; 2225always @(negedge C) begin 2226 if (R == 0) 2227 Q <= 1; 2228 else 2229 Q <= D; 2230end 2231endmodule 2232 2233// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2234//- 2235//- $_SDFF_NP0_ (D, C, R, Q) 2236//- 2237//- A negative edge D-type flip-flop with positive polarity synchronous reset. 2238//- 2239//- Truth table: D C R | Q 2240//- -------+--- 2241//- - \ 1 | 0 2242//- d \ - | d 2243//- - - - | q 2244//- 2245module \$_SDFF_NP0_ (D, C, R, Q); 2246input D, C, R; 2247output reg Q; 2248always @(negedge C) begin 2249 if (R == 1) 2250 Q <= 0; 2251 else 2252 Q <= D; 2253end 2254endmodule 2255 2256// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2257//- 2258//- $_SDFF_NP1_ (D, C, R, Q) 2259//- 2260//- A negative edge D-type flip-flop with positive polarity synchronous set. 2261//- 2262//- Truth table: D C R | Q 2263//- -------+--- 2264//- - \ 1 | 1 2265//- d \ - | d 2266//- - - - | q 2267//- 2268module \$_SDFF_NP1_ (D, C, R, Q); 2269input D, C, R; 2270output reg Q; 2271always @(negedge C) begin 2272 if (R == 1) 2273 Q <= 1; 2274 else 2275 Q <= D; 2276end 2277endmodule 2278 2279// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2280//- 2281//- $_SDFF_PN0_ (D, C, R, Q) 2282//- 2283//- A positive edge D-type flip-flop with negative polarity synchronous reset. 2284//- 2285//- Truth table: D C R | Q 2286//- -------+--- 2287//- - / 0 | 0 2288//- d / - | d 2289//- - - - | q 2290//- 2291module \$_SDFF_PN0_ (D, C, R, Q); 2292input D, C, R; 2293output reg Q; 2294always @(posedge C) begin 2295 if (R == 0) 2296 Q <= 0; 2297 else 2298 Q <= D; 2299end 2300endmodule 2301 2302// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2303//- 2304//- $_SDFF_PN1_ (D, C, R, Q) 2305//- 2306//- A positive edge D-type flip-flop with negative polarity synchronous set. 2307//- 2308//- Truth table: D C R | Q 2309//- -------+--- 2310//- - / 0 | 1 2311//- d / - | d 2312//- - - - | q 2313//- 2314module \$_SDFF_PN1_ (D, C, R, Q); 2315input D, C, R; 2316output reg Q; 2317always @(posedge C) begin 2318 if (R == 0) 2319 Q <= 1; 2320 else 2321 Q <= D; 2322end 2323endmodule 2324 2325// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2326//- 2327//- $_SDFF_PP0_ (D, C, R, Q) 2328//- 2329//- A positive edge D-type flip-flop with positive polarity synchronous reset. 2330//- 2331//- Truth table: D C R | Q 2332//- -------+--- 2333//- - / 1 | 0 2334//- d / - | d 2335//- - - - | q 2336//- 2337module \$_SDFF_PP0_ (D, C, R, Q); 2338input D, C, R; 2339output reg Q; 2340always @(posedge C) begin 2341 if (R == 1) 2342 Q <= 0; 2343 else 2344 Q <= D; 2345end 2346endmodule 2347 2348// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2349//- 2350//- $_SDFF_PP1_ (D, C, R, Q) 2351//- 2352//- A positive edge D-type flip-flop with positive polarity synchronous set. 2353//- 2354//- Truth table: D C R | Q 2355//- -------+--- 2356//- - / 1 | 1 2357//- d / - | d 2358//- - - - | q 2359//- 2360module \$_SDFF_PP1_ (D, C, R, Q); 2361input D, C, R; 2362output reg Q; 2363always @(posedge C) begin 2364 if (R == 1) 2365 Q <= 1; 2366 else 2367 Q <= D; 2368end 2369endmodule 2370 2371// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2372//- 2373//- $_SDFFE_NN0N_ (D, C, R, E, Q) 2374//- 2375//- A negative edge D-type flip-flop with negative polarity synchronous reset and negative 2376//- polarity clock enable (with reset having priority). 2377//- 2378//- Truth table: D C R E | Q 2379//- ---------+--- 2380//- - \ 0 - | 0 2381//- d \ - 0 | d 2382//- - - - - | q 2383//- 2384module \$_SDFFE_NN0N_ (D, C, R, E, Q); 2385input D, C, R, E; 2386output reg Q; 2387always @(negedge C) begin 2388 if (R == 0) 2389 Q <= 0; 2390 else if (E == 0) 2391 Q <= D; 2392end 2393endmodule 2394 2395// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2396//- 2397//- $_SDFFE_NN0P_ (D, C, R, E, Q) 2398//- 2399//- A negative edge D-type flip-flop with negative polarity synchronous reset and positive 2400//- polarity clock enable (with reset having priority). 2401//- 2402//- Truth table: D C R E | Q 2403//- ---------+--- 2404//- - \ 0 - | 0 2405//- d \ - 1 | d 2406//- - - - - | q 2407//- 2408module \$_SDFFE_NN0P_ (D, C, R, E, Q); 2409input D, C, R, E; 2410output reg Q; 2411always @(negedge C) begin 2412 if (R == 0) 2413 Q <= 0; 2414 else if (E == 1) 2415 Q <= D; 2416end 2417endmodule 2418 2419// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2420//- 2421//- $_SDFFE_NN1N_ (D, C, R, E, Q) 2422//- 2423//- A negative edge D-type flip-flop with negative polarity synchronous set and negative 2424//- polarity clock enable (with set having priority). 2425//- 2426//- Truth table: D C R E | Q 2427//- ---------+--- 2428//- - \ 0 - | 1 2429//- d \ - 0 | d 2430//- - - - - | q 2431//- 2432module \$_SDFFE_NN1N_ (D, C, R, E, Q); 2433input D, C, R, E; 2434output reg Q; 2435always @(negedge C) begin 2436 if (R == 0) 2437 Q <= 1; 2438 else if (E == 0) 2439 Q <= D; 2440end 2441endmodule 2442 2443// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2444//- 2445//- $_SDFFE_NN1P_ (D, C, R, E, Q) 2446//- 2447//- A negative edge D-type flip-flop with negative polarity synchronous set and positive 2448//- polarity clock enable (with set having priority). 2449//- 2450//- Truth table: D C R E | Q 2451//- ---------+--- 2452//- - \ 0 - | 1 2453//- d \ - 1 | d 2454//- - - - - | q 2455//- 2456module \$_SDFFE_NN1P_ (D, C, R, E, Q); 2457input D, C, R, E; 2458output reg Q; 2459always @(negedge C) begin 2460 if (R == 0) 2461 Q <= 1; 2462 else if (E == 1) 2463 Q <= D; 2464end 2465endmodule 2466 2467// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2468//- 2469//- $_SDFFE_NP0N_ (D, C, R, E, Q) 2470//- 2471//- A negative edge D-type flip-flop with positive polarity synchronous reset and negative 2472//- polarity clock enable (with reset having priority). 2473//- 2474//- Truth table: D C R E | Q 2475//- ---------+--- 2476//- - \ 1 - | 0 2477//- d \ - 0 | d 2478//- - - - - | q 2479//- 2480module \$_SDFFE_NP0N_ (D, C, R, E, Q); 2481input D, C, R, E; 2482output reg Q; 2483always @(negedge C) begin 2484 if (R == 1) 2485 Q <= 0; 2486 else if (E == 0) 2487 Q <= D; 2488end 2489endmodule 2490 2491// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2492//- 2493//- $_SDFFE_NP0P_ (D, C, R, E, Q) 2494//- 2495//- A negative edge D-type flip-flop with positive polarity synchronous reset and positive 2496//- polarity clock enable (with reset having priority). 2497//- 2498//- Truth table: D C R E | Q 2499//- ---------+--- 2500//- - \ 1 - | 0 2501//- d \ - 1 | d 2502//- - - - - | q 2503//- 2504module \$_SDFFE_NP0P_ (D, C, R, E, Q); 2505input D, C, R, E; 2506output reg Q; 2507always @(negedge C) begin 2508 if (R == 1) 2509 Q <= 0; 2510 else if (E == 1) 2511 Q <= D; 2512end 2513endmodule 2514 2515// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2516//- 2517//- $_SDFFE_NP1N_ (D, C, R, E, Q) 2518//- 2519//- A negative edge D-type flip-flop with positive polarity synchronous set and negative 2520//- polarity clock enable (with set having priority). 2521//- 2522//- Truth table: D C R E | Q 2523//- ---------+--- 2524//- - \ 1 - | 1 2525//- d \ - 0 | d 2526//- - - - - | q 2527//- 2528module \$_SDFFE_NP1N_ (D, C, R, E, Q); 2529input D, C, R, E; 2530output reg Q; 2531always @(negedge C) begin 2532 if (R == 1) 2533 Q <= 1; 2534 else if (E == 0) 2535 Q <= D; 2536end 2537endmodule 2538 2539// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2540//- 2541//- $_SDFFE_NP1P_ (D, C, R, E, Q) 2542//- 2543//- A negative edge D-type flip-flop with positive polarity synchronous set and positive 2544//- polarity clock enable (with set having priority). 2545//- 2546//- Truth table: D C R E | Q 2547//- ---------+--- 2548//- - \ 1 - | 1 2549//- d \ - 1 | d 2550//- - - - - | q 2551//- 2552module \$_SDFFE_NP1P_ (D, C, R, E, Q); 2553input D, C, R, E; 2554output reg Q; 2555always @(negedge C) begin 2556 if (R == 1) 2557 Q <= 1; 2558 else if (E == 1) 2559 Q <= D; 2560end 2561endmodule 2562 2563// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2564//- 2565//- $_SDFFE_PN0N_ (D, C, R, E, Q) 2566//- 2567//- A positive edge D-type flip-flop with negative polarity synchronous reset and negative 2568//- polarity clock enable (with reset having priority). 2569//- 2570//- Truth table: D C R E | Q 2571//- ---------+--- 2572//- - / 0 - | 0 2573//- d / - 0 | d 2574//- - - - - | q 2575//- 2576module \$_SDFFE_PN0N_ (D, C, R, E, Q); 2577input D, C, R, E; 2578output reg Q; 2579always @(posedge C) begin 2580 if (R == 0) 2581 Q <= 0; 2582 else if (E == 0) 2583 Q <= D; 2584end 2585endmodule 2586 2587// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2588//- 2589//- $_SDFFE_PN0P_ (D, C, R, E, Q) 2590//- 2591//- A positive edge D-type flip-flop with negative polarity synchronous reset and positive 2592//- polarity clock enable (with reset having priority). 2593//- 2594//- Truth table: D C R E | Q 2595//- ---------+--- 2596//- - / 0 - | 0 2597//- d / - 1 | d 2598//- - - - - | q 2599//- 2600module \$_SDFFE_PN0P_ (D, C, R, E, Q); 2601input D, C, R, E; 2602output reg Q; 2603always @(posedge C) begin 2604 if (R == 0) 2605 Q <= 0; 2606 else if (E == 1) 2607 Q <= D; 2608end 2609endmodule 2610 2611// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2612//- 2613//- $_SDFFE_PN1N_ (D, C, R, E, Q) 2614//- 2615//- A positive edge D-type flip-flop with negative polarity synchronous set and negative 2616//- polarity clock enable (with set having priority). 2617//- 2618//- Truth table: D C R E | Q 2619//- ---------+--- 2620//- - / 0 - | 1 2621//- d / - 0 | d 2622//- - - - - | q 2623//- 2624module \$_SDFFE_PN1N_ (D, C, R, E, Q); 2625input D, C, R, E; 2626output reg Q; 2627always @(posedge C) begin 2628 if (R == 0) 2629 Q <= 1; 2630 else if (E == 0) 2631 Q <= D; 2632end 2633endmodule 2634 2635// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2636//- 2637//- $_SDFFE_PN1P_ (D, C, R, E, Q) 2638//- 2639//- A positive edge D-type flip-flop with negative polarity synchronous set and positive 2640//- polarity clock enable (with set having priority). 2641//- 2642//- Truth table: D C R E | Q 2643//- ---------+--- 2644//- - / 0 - | 1 2645//- d / - 1 | d 2646//- - - - - | q 2647//- 2648module \$_SDFFE_PN1P_ (D, C, R, E, Q); 2649input D, C, R, E; 2650output reg Q; 2651always @(posedge C) begin 2652 if (R == 0) 2653 Q <= 1; 2654 else if (E == 1) 2655 Q <= D; 2656end 2657endmodule 2658 2659// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2660//- 2661//- $_SDFFE_PP0N_ (D, C, R, E, Q) 2662//- 2663//- A positive edge D-type flip-flop with positive polarity synchronous reset and negative 2664//- polarity clock enable (with reset having priority). 2665//- 2666//- Truth table: D C R E | Q 2667//- ---------+--- 2668//- - / 1 - | 0 2669//- d / - 0 | d 2670//- - - - - | q 2671//- 2672module \$_SDFFE_PP0N_ (D, C, R, E, Q); 2673input D, C, R, E; 2674output reg Q; 2675always @(posedge C) begin 2676 if (R == 1) 2677 Q <= 0; 2678 else if (E == 0) 2679 Q <= D; 2680end 2681endmodule 2682 2683// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2684//- 2685//- $_SDFFE_PP0P_ (D, C, R, E, Q) 2686//- 2687//- A positive edge D-type flip-flop with positive polarity synchronous reset and positive 2688//- polarity clock enable (with reset having priority). 2689//- 2690//- Truth table: D C R E | Q 2691//- ---------+--- 2692//- - / 1 - | 0 2693//- d / - 1 | d 2694//- - - - - | q 2695//- 2696module \$_SDFFE_PP0P_ (D, C, R, E, Q); 2697input D, C, R, E; 2698output reg Q; 2699always @(posedge C) begin 2700 if (R == 1) 2701 Q <= 0; 2702 else if (E == 1) 2703 Q <= D; 2704end 2705endmodule 2706 2707// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2708//- 2709//- $_SDFFE_PP1N_ (D, C, R, E, Q) 2710//- 2711//- A positive edge D-type flip-flop with positive polarity synchronous set and negative 2712//- polarity clock enable (with set having priority). 2713//- 2714//- Truth table: D C R E | Q 2715//- ---------+--- 2716//- - / 1 - | 1 2717//- d / - 0 | d 2718//- - - - - | q 2719//- 2720module \$_SDFFE_PP1N_ (D, C, R, E, Q); 2721input D, C, R, E; 2722output reg Q; 2723always @(posedge C) begin 2724 if (R == 1) 2725 Q <= 1; 2726 else if (E == 0) 2727 Q <= D; 2728end 2729endmodule 2730 2731// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2732//- 2733//- $_SDFFE_PP1P_ (D, C, R, E, Q) 2734//- 2735//- A positive edge D-type flip-flop with positive polarity synchronous set and positive 2736//- polarity clock enable (with set having priority). 2737//- 2738//- Truth table: D C R E | Q 2739//- ---------+--- 2740//- - / 1 - | 1 2741//- d / - 1 | d 2742//- - - - - | q 2743//- 2744module \$_SDFFE_PP1P_ (D, C, R, E, Q); 2745input D, C, R, E; 2746output reg Q; 2747always @(posedge C) begin 2748 if (R == 1) 2749 Q <= 1; 2750 else if (E == 1) 2751 Q <= D; 2752end 2753endmodule 2754 2755// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2756//- 2757//- $_SDFFCE_NN0N_ (D, C, R, E, Q) 2758//- 2759//- A negative edge D-type flip-flop with negative polarity synchronous reset and negative 2760//- polarity clock enable (with clock enable having priority). 2761//- 2762//- Truth table: D C R E | Q 2763//- ---------+--- 2764//- - \ 0 0 | 0 2765//- d \ - 0 | d 2766//- - - - - | q 2767//- 2768module \$_SDFFCE_NN0N_ (D, C, R, E, Q); 2769input D, C, R, E; 2770output reg Q; 2771always @(negedge C) begin 2772 if (E == 0) begin 2773 if (R == 0) 2774 Q <= 0; 2775 else 2776 Q <= D; 2777 end 2778end 2779endmodule 2780 2781// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2782//- 2783//- $_SDFFCE_NN0P_ (D, C, R, E, Q) 2784//- 2785//- A negative edge D-type flip-flop with negative polarity synchronous reset and positive 2786//- polarity clock enable (with clock enable having priority). 2787//- 2788//- Truth table: D C R E | Q 2789//- ---------+--- 2790//- - \ 0 1 | 0 2791//- d \ - 1 | d 2792//- - - - - | q 2793//- 2794module \$_SDFFCE_NN0P_ (D, C, R, E, Q); 2795input D, C, R, E; 2796output reg Q; 2797always @(negedge C) begin 2798 if (E == 1) begin 2799 if (R == 0) 2800 Q <= 0; 2801 else 2802 Q <= D; 2803 end 2804end 2805endmodule 2806 2807// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2808//- 2809//- $_SDFFCE_NN1N_ (D, C, R, E, Q) 2810//- 2811//- A negative edge D-type flip-flop with negative polarity synchronous set and negative 2812//- polarity clock enable (with clock enable having priority). 2813//- 2814//- Truth table: D C R E | Q 2815//- ---------+--- 2816//- - \ 0 0 | 1 2817//- d \ - 0 | d 2818//- - - - - | q 2819//- 2820module \$_SDFFCE_NN1N_ (D, C, R, E, Q); 2821input D, C, R, E; 2822output reg Q; 2823always @(negedge C) begin 2824 if (E == 0) begin 2825 if (R == 0) 2826 Q <= 1; 2827 else 2828 Q <= D; 2829 end 2830end 2831endmodule 2832 2833// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2834//- 2835//- $_SDFFCE_NN1P_ (D, C, R, E, Q) 2836//- 2837//- A negative edge D-type flip-flop with negative polarity synchronous set and positive 2838//- polarity clock enable (with clock enable having priority). 2839//- 2840//- Truth table: D C R E | Q 2841//- ---------+--- 2842//- - \ 0 1 | 1 2843//- d \ - 1 | d 2844//- - - - - | q 2845//- 2846module \$_SDFFCE_NN1P_ (D, C, R, E, Q); 2847input D, C, R, E; 2848output reg Q; 2849always @(negedge C) begin 2850 if (E == 1) begin 2851 if (R == 0) 2852 Q <= 1; 2853 else 2854 Q <= D; 2855 end 2856end 2857endmodule 2858 2859// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2860//- 2861//- $_SDFFCE_NP0N_ (D, C, R, E, Q) 2862//- 2863//- A negative edge D-type flip-flop with positive polarity synchronous reset and negative 2864//- polarity clock enable (with clock enable having priority). 2865//- 2866//- Truth table: D C R E | Q 2867//- ---------+--- 2868//- - \ 1 0 | 0 2869//- d \ - 0 | d 2870//- - - - - | q 2871//- 2872module \$_SDFFCE_NP0N_ (D, C, R, E, Q); 2873input D, C, R, E; 2874output reg Q; 2875always @(negedge C) begin 2876 if (E == 0) begin 2877 if (R == 1) 2878 Q <= 0; 2879 else 2880 Q <= D; 2881 end 2882end 2883endmodule 2884 2885// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2886//- 2887//- $_SDFFCE_NP0P_ (D, C, R, E, Q) 2888//- 2889//- A negative edge D-type flip-flop with positive polarity synchronous reset and positive 2890//- polarity clock enable (with clock enable having priority). 2891//- 2892//- Truth table: D C R E | Q 2893//- ---------+--- 2894//- - \ 1 1 | 0 2895//- d \ - 1 | d 2896//- - - - - | q 2897//- 2898module \$_SDFFCE_NP0P_ (D, C, R, E, Q); 2899input D, C, R, E; 2900output reg Q; 2901always @(negedge C) begin 2902 if (E == 1) begin 2903 if (R == 1) 2904 Q <= 0; 2905 else 2906 Q <= D; 2907 end 2908end 2909endmodule 2910 2911// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2912//- 2913//- $_SDFFCE_NP1N_ (D, C, R, E, Q) 2914//- 2915//- A negative edge D-type flip-flop with positive polarity synchronous set and negative 2916//- polarity clock enable (with clock enable having priority). 2917//- 2918//- Truth table: D C R E | Q 2919//- ---------+--- 2920//- - \ 1 0 | 1 2921//- d \ - 0 | d 2922//- - - - - | q 2923//- 2924module \$_SDFFCE_NP1N_ (D, C, R, E, Q); 2925input D, C, R, E; 2926output reg Q; 2927always @(negedge C) begin 2928 if (E == 0) begin 2929 if (R == 1) 2930 Q <= 1; 2931 else 2932 Q <= D; 2933 end 2934end 2935endmodule 2936 2937// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2938//- 2939//- $_SDFFCE_NP1P_ (D, C, R, E, Q) 2940//- 2941//- A negative edge D-type flip-flop with positive polarity synchronous set and positive 2942//- polarity clock enable (with clock enable having priority). 2943//- 2944//- Truth table: D C R E | Q 2945//- ---------+--- 2946//- - \ 1 1 | 1 2947//- d \ - 1 | d 2948//- - - - - | q 2949//- 2950module \$_SDFFCE_NP1P_ (D, C, R, E, Q); 2951input D, C, R, E; 2952output reg Q; 2953always @(negedge C) begin 2954 if (E == 1) begin 2955 if (R == 1) 2956 Q <= 1; 2957 else 2958 Q <= D; 2959 end 2960end 2961endmodule 2962 2963// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2964//- 2965//- $_SDFFCE_PN0N_ (D, C, R, E, Q) 2966//- 2967//- A positive edge D-type flip-flop with negative polarity synchronous reset and negative 2968//- polarity clock enable (with clock enable having priority). 2969//- 2970//- Truth table: D C R E | Q 2971//- ---------+--- 2972//- - / 0 0 | 0 2973//- d / - 0 | d 2974//- - - - - | q 2975//- 2976module \$_SDFFCE_PN0N_ (D, C, R, E, Q); 2977input D, C, R, E; 2978output reg Q; 2979always @(posedge C) begin 2980 if (E == 0) begin 2981 if (R == 0) 2982 Q <= 0; 2983 else 2984 Q <= D; 2985 end 2986end 2987endmodule 2988 2989// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 2990//- 2991//- $_SDFFCE_PN0P_ (D, C, R, E, Q) 2992//- 2993//- A positive edge D-type flip-flop with negative polarity synchronous reset and positive 2994//- polarity clock enable (with clock enable having priority). 2995//- 2996//- Truth table: D C R E | Q 2997//- ---------+--- 2998//- - / 0 1 | 0 2999//- d / - 1 | d 3000//- - - - - | q 3001//- 3002module \$_SDFFCE_PN0P_ (D, C, R, E, Q); 3003input D, C, R, E; 3004output reg Q; 3005always @(posedge C) begin 3006 if (E == 1) begin 3007 if (R == 0) 3008 Q <= 0; 3009 else 3010 Q <= D; 3011 end 3012end 3013endmodule 3014 3015// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3016//- 3017//- $_SDFFCE_PN1N_ (D, C, R, E, Q) 3018//- 3019//- A positive edge D-type flip-flop with negative polarity synchronous set and negative 3020//- polarity clock enable (with clock enable having priority). 3021//- 3022//- Truth table: D C R E | Q 3023//- ---------+--- 3024//- - / 0 0 | 1 3025//- d / - 0 | d 3026//- - - - - | q 3027//- 3028module \$_SDFFCE_PN1N_ (D, C, R, E, Q); 3029input D, C, R, E; 3030output reg Q; 3031always @(posedge C) begin 3032 if (E == 0) begin 3033 if (R == 0) 3034 Q <= 1; 3035 else 3036 Q <= D; 3037 end 3038end 3039endmodule 3040 3041// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3042//- 3043//- $_SDFFCE_PN1P_ (D, C, R, E, Q) 3044//- 3045//- A positive edge D-type flip-flop with negative polarity synchronous set and positive 3046//- polarity clock enable (with clock enable having priority). 3047//- 3048//- Truth table: D C R E | Q 3049//- ---------+--- 3050//- - / 0 1 | 1 3051//- d / - 1 | d 3052//- - - - - | q 3053//- 3054module \$_SDFFCE_PN1P_ (D, C, R, E, Q); 3055input D, C, R, E; 3056output reg Q; 3057always @(posedge C) begin 3058 if (E == 1) begin 3059 if (R == 0) 3060 Q <= 1; 3061 else 3062 Q <= D; 3063 end 3064end 3065endmodule 3066 3067// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3068//- 3069//- $_SDFFCE_PP0N_ (D, C, R, E, Q) 3070//- 3071//- A positive edge D-type flip-flop with positive polarity synchronous reset and negative 3072//- polarity clock enable (with clock enable having priority). 3073//- 3074//- Truth table: D C R E | Q 3075//- ---------+--- 3076//- - / 1 0 | 0 3077//- d / - 0 | d 3078//- - - - - | q 3079//- 3080module \$_SDFFCE_PP0N_ (D, C, R, E, Q); 3081input D, C, R, E; 3082output reg Q; 3083always @(posedge C) begin 3084 if (E == 0) begin 3085 if (R == 1) 3086 Q <= 0; 3087 else 3088 Q <= D; 3089 end 3090end 3091endmodule 3092 3093// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3094//- 3095//- $_SDFFCE_PP0P_ (D, C, R, E, Q) 3096//- 3097//- A positive edge D-type flip-flop with positive polarity synchronous reset and positive 3098//- polarity clock enable (with clock enable having priority). 3099//- 3100//- Truth table: D C R E | Q 3101//- ---------+--- 3102//- - / 1 1 | 0 3103//- d / - 1 | d 3104//- - - - - | q 3105//- 3106module \$_SDFFCE_PP0P_ (D, C, R, E, Q); 3107input D, C, R, E; 3108output reg Q; 3109always @(posedge C) begin 3110 if (E == 1) begin 3111 if (R == 1) 3112 Q <= 0; 3113 else 3114 Q <= D; 3115 end 3116end 3117endmodule 3118 3119// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3120//- 3121//- $_SDFFCE_PP1N_ (D, C, R, E, Q) 3122//- 3123//- A positive edge D-type flip-flop with positive polarity synchronous set and negative 3124//- polarity clock enable (with clock enable having priority). 3125//- 3126//- Truth table: D C R E | Q 3127//- ---------+--- 3128//- - / 1 0 | 1 3129//- d / - 0 | d 3130//- - - - - | q 3131//- 3132module \$_SDFFCE_PP1N_ (D, C, R, E, Q); 3133input D, C, R, E; 3134output reg Q; 3135always @(posedge C) begin 3136 if (E == 0) begin 3137 if (R == 1) 3138 Q <= 1; 3139 else 3140 Q <= D; 3141 end 3142end 3143endmodule 3144 3145// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3146//- 3147//- $_SDFFCE_PP1P_ (D, C, R, E, Q) 3148//- 3149//- A positive edge D-type flip-flop with positive polarity synchronous set and positive 3150//- polarity clock enable (with clock enable having priority). 3151//- 3152//- Truth table: D C R E | Q 3153//- ---------+--- 3154//- - / 1 1 | 1 3155//- d / - 1 | d 3156//- - - - - | q 3157//- 3158module \$_SDFFCE_PP1P_ (D, C, R, E, Q); 3159input D, C, R, E; 3160output reg Q; 3161always @(posedge C) begin 3162 if (E == 1) begin 3163 if (R == 1) 3164 Q <= 1; 3165 else 3166 Q <= D; 3167 end 3168end 3169endmodule 3170 3171// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3172//- 3173//- $_DLATCH_N_ (E, D, Q) 3174//- 3175//- A negative enable D-type latch. 3176//- 3177//- Truth table: E D | Q 3178//- -----+--- 3179//- 0 d | d 3180//- - - | q 3181//- 3182module \$_DLATCH_N_ (E, D, Q); 3183input E, D; 3184output reg Q; 3185always @* begin 3186 if (E == 0) 3187 Q <= D; 3188end 3189endmodule 3190 3191// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3192//- 3193//- $_DLATCH_P_ (E, D, Q) 3194//- 3195//- A positive enable D-type latch. 3196//- 3197//- Truth table: E D | Q 3198//- -----+--- 3199//- 1 d | d 3200//- - - | q 3201//- 3202module \$_DLATCH_P_ (E, D, Q); 3203input E, D; 3204output reg Q; 3205always @* begin 3206 if (E == 1) 3207 Q <= D; 3208end 3209endmodule 3210 3211// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3212//- 3213//- $_DLATCH_NN0_ (E, R, D, Q) 3214//- 3215//- A negative enable D-type latch with negative polarity reset. 3216//- 3217//- Truth table: E R D | Q 3218//- -------+--- 3219//- - 0 - | 0 3220//- 0 - d | d 3221//- - - - | q 3222//- 3223module \$_DLATCH_NN0_ (E, R, D, Q); 3224input E, R, D; 3225output reg Q; 3226always @* begin 3227 if (R == 0) 3228 Q <= 0; 3229 else if (E == 0) 3230 Q <= D; 3231end 3232endmodule 3233 3234// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3235//- 3236//- $_DLATCH_NN1_ (E, R, D, Q) 3237//- 3238//- A negative enable D-type latch with negative polarity set. 3239//- 3240//- Truth table: E R D | Q 3241//- -------+--- 3242//- - 0 - | 1 3243//- 0 - d | d 3244//- - - - | q 3245//- 3246module \$_DLATCH_NN1_ (E, R, D, Q); 3247input E, R, D; 3248output reg Q; 3249always @* begin 3250 if (R == 0) 3251 Q <= 1; 3252 else if (E == 0) 3253 Q <= D; 3254end 3255endmodule 3256 3257// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3258//- 3259//- $_DLATCH_NP0_ (E, R, D, Q) 3260//- 3261//- A negative enable D-type latch with positive polarity reset. 3262//- 3263//- Truth table: E R D | Q 3264//- -------+--- 3265//- - 1 - | 0 3266//- 0 - d | d 3267//- - - - | q 3268//- 3269module \$_DLATCH_NP0_ (E, R, D, Q); 3270input E, R, D; 3271output reg Q; 3272always @* begin 3273 if (R == 1) 3274 Q <= 0; 3275 else if (E == 0) 3276 Q <= D; 3277end 3278endmodule 3279 3280// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3281//- 3282//- $_DLATCH_NP1_ (E, R, D, Q) 3283//- 3284//- A negative enable D-type latch with positive polarity set. 3285//- 3286//- Truth table: E R D | Q 3287//- -------+--- 3288//- - 1 - | 1 3289//- 0 - d | d 3290//- - - - | q 3291//- 3292module \$_DLATCH_NP1_ (E, R, D, Q); 3293input E, R, D; 3294output reg Q; 3295always @* begin 3296 if (R == 1) 3297 Q <= 1; 3298 else if (E == 0) 3299 Q <= D; 3300end 3301endmodule 3302 3303// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3304//- 3305//- $_DLATCH_PN0_ (E, R, D, Q) 3306//- 3307//- A positive enable D-type latch with negative polarity reset. 3308//- 3309//- Truth table: E R D | Q 3310//- -------+--- 3311//- - 0 - | 0 3312//- 1 - d | d 3313//- - - - | q 3314//- 3315module \$_DLATCH_PN0_ (E, R, D, Q); 3316input E, R, D; 3317output reg Q; 3318always @* begin 3319 if (R == 0) 3320 Q <= 0; 3321 else if (E == 1) 3322 Q <= D; 3323end 3324endmodule 3325 3326// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3327//- 3328//- $_DLATCH_PN1_ (E, R, D, Q) 3329//- 3330//- A positive enable D-type latch with negative polarity set. 3331//- 3332//- Truth table: E R D | Q 3333//- -------+--- 3334//- - 0 - | 1 3335//- 1 - d | d 3336//- - - - | q 3337//- 3338module \$_DLATCH_PN1_ (E, R, D, Q); 3339input E, R, D; 3340output reg Q; 3341always @* begin 3342 if (R == 0) 3343 Q <= 1; 3344 else if (E == 1) 3345 Q <= D; 3346end 3347endmodule 3348 3349// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3350//- 3351//- $_DLATCH_PP0_ (E, R, D, Q) 3352//- 3353//- A positive enable D-type latch with positive polarity reset. 3354//- 3355//- Truth table: E R D | Q 3356//- -------+--- 3357//- - 1 - | 0 3358//- 1 - d | d 3359//- - - - | q 3360//- 3361module \$_DLATCH_PP0_ (E, R, D, Q); 3362input E, R, D; 3363output reg Q; 3364always @* begin 3365 if (R == 1) 3366 Q <= 0; 3367 else if (E == 1) 3368 Q <= D; 3369end 3370endmodule 3371 3372// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3373//- 3374//- $_DLATCH_PP1_ (E, R, D, Q) 3375//- 3376//- A positive enable D-type latch with positive polarity set. 3377//- 3378//- Truth table: E R D | Q 3379//- -------+--- 3380//- - 1 - | 1 3381//- 1 - d | d 3382//- - - - | q 3383//- 3384module \$_DLATCH_PP1_ (E, R, D, Q); 3385input E, R, D; 3386output reg Q; 3387always @* begin 3388 if (R == 1) 3389 Q <= 1; 3390 else if (E == 1) 3391 Q <= D; 3392end 3393endmodule 3394 3395// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3396//- 3397//- $_DLATCHSR_NNN_ (E, S, R, D, Q) 3398//- 3399//- A negative enable D-type latch with negative polarity set and negative 3400//- polarity reset. 3401//- 3402//- Truth table: E S R D | Q 3403//- ---------+--- 3404//- - - 0 - | 0 3405//- - 0 - - | 1 3406//- 0 - - d | d 3407//- - - - - | q 3408//- 3409module \$_DLATCHSR_NNN_ (E, S, R, D, Q); 3410input E, S, R, D; 3411output reg Q; 3412always @* begin 3413 if (R == 0) 3414 Q <= 0; 3415 else if (S == 0) 3416 Q <= 1; 3417 else if (E == 0) 3418 Q <= D; 3419end 3420endmodule 3421 3422// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3423//- 3424//- $_DLATCHSR_NNP_ (E, S, R, D, Q) 3425//- 3426//- A negative enable D-type latch with negative polarity set and positive 3427//- polarity reset. 3428//- 3429//- Truth table: E S R D | Q 3430//- ---------+--- 3431//- - - 1 - | 0 3432//- - 0 - - | 1 3433//- 0 - - d | d 3434//- - - - - | q 3435//- 3436module \$_DLATCHSR_NNP_ (E, S, R, D, Q); 3437input E, S, R, D; 3438output reg Q; 3439always @* begin 3440 if (R == 1) 3441 Q <= 0; 3442 else if (S == 0) 3443 Q <= 1; 3444 else if (E == 0) 3445 Q <= D; 3446end 3447endmodule 3448 3449// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3450//- 3451//- $_DLATCHSR_NPN_ (E, S, R, D, Q) 3452//- 3453//- A negative enable D-type latch with positive polarity set and negative 3454//- polarity reset. 3455//- 3456//- Truth table: E S R D | Q 3457//- ---------+--- 3458//- - - 0 - | 0 3459//- - 1 - - | 1 3460//- 0 - - d | d 3461//- - - - - | q 3462//- 3463module \$_DLATCHSR_NPN_ (E, S, R, D, Q); 3464input E, S, R, D; 3465output reg Q; 3466always @* begin 3467 if (R == 0) 3468 Q <= 0; 3469 else if (S == 1) 3470 Q <= 1; 3471 else if (E == 0) 3472 Q <= D; 3473end 3474endmodule 3475 3476// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3477//- 3478//- $_DLATCHSR_NPP_ (E, S, R, D, Q) 3479//- 3480//- A negative enable D-type latch with positive polarity set and positive 3481//- polarity reset. 3482//- 3483//- Truth table: E S R D | Q 3484//- ---------+--- 3485//- - - 1 - | 0 3486//- - 1 - - | 1 3487//- 0 - - d | d 3488//- - - - - | q 3489//- 3490module \$_DLATCHSR_NPP_ (E, S, R, D, Q); 3491input E, S, R, D; 3492output reg Q; 3493always @* begin 3494 if (R == 1) 3495 Q <= 0; 3496 else if (S == 1) 3497 Q <= 1; 3498 else if (E == 0) 3499 Q <= D; 3500end 3501endmodule 3502 3503// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3504//- 3505//- $_DLATCHSR_PNN_ (E, S, R, D, Q) 3506//- 3507//- A positive enable D-type latch with negative polarity set and negative 3508//- polarity reset. 3509//- 3510//- Truth table: E S R D | Q 3511//- ---------+--- 3512//- - - 0 - | 0 3513//- - 0 - - | 1 3514//- 1 - - d | d 3515//- - - - - | q 3516//- 3517module \$_DLATCHSR_PNN_ (E, S, R, D, Q); 3518input E, S, R, D; 3519output reg Q; 3520always @* begin 3521 if (R == 0) 3522 Q <= 0; 3523 else if (S == 0) 3524 Q <= 1; 3525 else if (E == 1) 3526 Q <= D; 3527end 3528endmodule 3529 3530// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3531//- 3532//- $_DLATCHSR_PNP_ (E, S, R, D, Q) 3533//- 3534//- A positive enable D-type latch with negative polarity set and positive 3535//- polarity reset. 3536//- 3537//- Truth table: E S R D | Q 3538//- ---------+--- 3539//- - - 1 - | 0 3540//- - 0 - - | 1 3541//- 1 - - d | d 3542//- - - - - | q 3543//- 3544module \$_DLATCHSR_PNP_ (E, S, R, D, Q); 3545input E, S, R, D; 3546output reg Q; 3547always @* begin 3548 if (R == 1) 3549 Q <= 0; 3550 else if (S == 0) 3551 Q <= 1; 3552 else if (E == 1) 3553 Q <= D; 3554end 3555endmodule 3556 3557// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3558//- 3559//- $_DLATCHSR_PPN_ (E, S, R, D, Q) 3560//- 3561//- A positive enable D-type latch with positive polarity set and negative 3562//- polarity reset. 3563//- 3564//- Truth table: E S R D | Q 3565//- ---------+--- 3566//- - - 0 - | 0 3567//- - 1 - - | 1 3568//- 1 - - d | d 3569//- - - - - | q 3570//- 3571module \$_DLATCHSR_PPN_ (E, S, R, D, Q); 3572input E, S, R, D; 3573output reg Q; 3574always @* begin 3575 if (R == 0) 3576 Q <= 0; 3577 else if (S == 1) 3578 Q <= 1; 3579 else if (E == 1) 3580 Q <= D; 3581end 3582endmodule 3583 3584// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| 3585//- 3586//- $_DLATCHSR_PPP_ (E, S, R, D, Q) 3587//- 3588//- A positive enable D-type latch with positive polarity set and positive 3589//- polarity reset. 3590//- 3591//- Truth table: E S R D | Q 3592//- ---------+--- 3593//- - - 1 - | 0 3594//- - 1 - - | 1 3595//- 1 - - d | d 3596//- - - - - | q 3597//- 3598module \$_DLATCHSR_PPP_ (E, S, R, D, Q); 3599input E, S, R, D; 3600output reg Q; 3601always @* begin 3602 if (R == 1) 3603 Q <= 0; 3604 else if (S == 1) 3605 Q <= 1; 3606 else if (E == 1) 3607 Q <= D; 3608end 3609endmodule 3610