OpenCores
URL https://opencores.org/ocsvn/oops/oops/trunk

Subversion Repositories oops

[/] [oops/] [trunk/] [rtl/] [ooops_lib.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 smjoshua
 
2
//////////////////////////////////////////////////////////////////
3
//                                                              //
4
//  OoOPs common module library                                 //
5
//                                                              //
6
//  This file is part of the OoOPs project                      //
7
//  http://www.opencores.org/project,oops                       //
8
//                                                              //
9
//  Description:                                                //
10
//  Basic library of common blocks such as different types of   //
11
//  flops, etc...                                               //
12
//                                                              //
13
//  Author(s):                                                  //
14
//      - Joshua Smith, smjoshua@umich.edu                      //
15
//                                                              //
16
//////////////////////////////////////////////////////////////////
17
//                                                              //
18
// Copyright (C) 2012 Authors and OPENCORES.ORG                 //
19
//                                                              //
20
// This source file may be used and distributed without         //
21
// restriction provided that this copyright statement is not    //
22
// removed from the file and that any derivative work contains  //
23
// the original copyright notice and the associated disclaimer. //
24
//                                                              //
25
// This source file is free software; you can redistribute it   //
26
// and/or modify it under the terms of the GNU Lesser General   //
27
// Public License as published by the Free Software Foundation; //
28
// either version 2.1 of the License, or (at your option) any   //
29
// later version.                                               //
30
//                                                              //
31
// This source is distributed in the hope that it will be       //
32
// useful, but WITHOUT ANY WARRANTY; without even the implied   //
33
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
34
// PURPOSE.  See the GNU Lesser General Public License for more //
35
// details.                                                     //
36
//                                                              //
37
// You should have received a copy of the GNU Lesser General    //
38
// Public License along with this source; if not, download it   //
39
// from http://www.opencores.org/lgpl.shtml                     //
40
//                                                              //
41
//////////////////////////////////////////////////////////////////
42
`include "ooops_defs.v"
43
 
44
// Regular DFF
45
module MDFF #(parameter DW = 1) (
46
  input wire          clk,
47
  input wire [DW-1:0] din,
48
  output reg [DW-1:0] dout
49
  );
50
 
51
  always @(posedge clk)
52
    dout <= `SD din;
53
 
54
endmodule
55
 
56
// Loadable DFF
57
module MDFFL #(parameter DW = 1) (
58
  input wire          clk,
59
  input wire          ld,
60
  input wire [DW-1:0] din,
61
  output reg [DW-1:0] dout
62
  );
63
 
64
  always @(posedge clk)
65
    if (ld) dout <= `SD din;
66
 
67
endmodule
68
 
69
// Resetable DFF
70
module MDFFR #(parameter DW = 1) (
71
  input wire          clk,
72
  input wire          rst,
73
  input wire [DW-1:0] rst_din,
74
  input wire [DW-1:0] din,
75
  output reg [DW-1:0] dout
76
  );
77
 
78
  always @(posedge clk)
79
    if (rst)  dout <= `SD rst_din;
80
    else      dout <= `SD din;
81
 
82
endmodule
83
 
84
// Loadable, resetable DFF
85
module MDFFLR #(parameter DW = 1) (
86
  input wire          clk,
87
  input wire          rst,
88
  input wire          ld,
89
  input wire [DW-1:0] rst_din,
90
  input wire [DW-1:0] din,
91
  output reg [DW-1:0] dout
92
  );
93
 
94
  always @(posedge clk)
95
    if (rst)      dout <= `SD rst_din;
96
    else if (ld)  dout <= `SD din;
97
 
98
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.