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

Subversion Repositories versatile_library

[/] [versatile_library/] [trunk/] [rtl/] [verilog/] [registers.v] - Blame information for rev 3

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 unneback
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  Versatile library, registers                                ////
4
////                                                              ////
5
////  Description                                                 ////
6
////  Different type of registers                                 ////
7
////                                                              ////
8
////                                                              ////
9
////  To Do:                                                      ////
10
////   - add more different registers                             ////
11
////                                                              ////
12
////  Author(s):                                                  ////
13
////      - Michael Unneback, unneback@opencores.org              ////
14
////        ORSoC AB                                              ////
15
////                                                              ////
16
//////////////////////////////////////////////////////////////////////
17
////                                                              ////
18
//// Copyright (C) 2010 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
 
43
module dff ( d, q, clk, rst);
44
 
45
        parameter width = 1;
46
        parameter reset_value = 0;
47
 
48
        input [width-1:0] d;
49
        input clk, rst;
50
        output reg [width-1:0] q;
51
 
52
        always @ (posedge clk or posedge rst)
53
        if (rst)
54
                q <= reset_value;
55
        else
56
                q <= d;
57
 
58
endmodule
59
 
60
module dff_ce ( d, ce, q, clk, rst);
61
 
62
        parameter width = 1;
63
        parameter reset_value = 0;
64
 
65
        input [width-1:0] d;
66
        input ce, clk, rst;
67
        output reg [width-1:0] q;
68
 
69
        always @ (posedge clk or posedge rst)
70
        if (rst)
71
                q <= reset_value;
72
        else
73
                if (ce)
74
                        q <= d;
75
 
76
endmodule
77
 
78
`ifdef ALTERA
79
// megafunction wizard: %LPM_FF%
80
// GENERATION: STANDARD
81
// VERSION: WM1.0
82
// MODULE: lpm_ff 
83
 
84
// ============================================================
85
// File Name: dff_sr.v
86
// Megafunction Name(s):
87
//                      lpm_ff
88
//
89
// Simulation Library Files(s):
90
//                      lpm
91
// ============================================================
92
// ************************************************************
93
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
94
//
95
// 9.1 Build 304 01/25/2010 SP 1 SJ Full Version
96
// ************************************************************
97
 
98
 
99
//Copyright (C) 1991-2010 Altera Corporation
100
//Your use of Altera Corporation's design tools, logic functions 
101
//and other software and tools, and its AMPP partner logic 
102
//functions, and any output files from any of the foregoing 
103
//(including device programming or simulation files), and any 
104
//associated documentation or information are expressly subject 
105
//to the terms and conditions of the Altera Program License 
106
//Subscription Agreement, Altera MegaCore Function License 
107
//Agreement, or other applicable license agreement, including, 
108
//without limitation, that your use is for the sole purpose of 
109
//programming logic devices manufactured by Altera and sold by 
110
//Altera or its authorized distributors.  Please refer to the 
111
//applicable agreement for further details.
112
 
113
 
114
// synopsys translate_off
115
`timescale 1 ps / 1 ps
116
// synopsys translate_on
117
module dff_sr (
118
        aclr,
119
        aset,
120
        clock,
121
        data,
122
        q);
123
 
124
        input     aclr;
125
        input     aset;
126
        input     clock;
127
        input     data;
128
        output    q;
129
 
130
        wire [0:0] sub_wire0;
131
        wire [0:0] sub_wire1 = sub_wire0[0:0];
132
        wire  q = sub_wire1;
133
        wire  sub_wire2 = data;
134
        wire  sub_wire3 = sub_wire2;
135
 
136
        lpm_ff  lpm_ff_component (
137
                                .aclr (aclr),
138
                                .clock (clock),
139
                                .data (sub_wire3),
140
                                .aset (aset),
141
                                .q (sub_wire0)
142
                                // synopsys translate_off
143
                                ,
144
                                .aload (),
145
                                .enable (),
146
                                .sclr (),
147
                                .sload (),
148
                                .sset ()
149
                                // synopsys translate_on
150
                                );
151
        defparam
152
                lpm_ff_component.lpm_fftype = "DFF",
153
                lpm_ff_component.lpm_type = "LPM_FF",
154
                lpm_ff_component.lpm_width = 1;
155
 
156
 
157
endmodule
158
 
159
// ============================================================
160
// CNX file retrieval info
161
// ============================================================
162
// Retrieval info: PRIVATE: ACLR NUMERIC "1"
163
// Retrieval info: PRIVATE: ALOAD NUMERIC "0"
164
// Retrieval info: PRIVATE: ASET NUMERIC "1"
165
// Retrieval info: PRIVATE: ASET_ALL1 NUMERIC "1"
166
// Retrieval info: PRIVATE: CLK_EN NUMERIC "0"
167
// Retrieval info: PRIVATE: DFF NUMERIC "1"
168
// Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E"
169
// Retrieval info: PRIVATE: SCLR NUMERIC "0"
170
// Retrieval info: PRIVATE: SLOAD NUMERIC "0"
171
// Retrieval info: PRIVATE: SSET NUMERIC "0"
172
// Retrieval info: PRIVATE: SSET_ALL1 NUMERIC "1"
173
// Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
174
// Retrieval info: PRIVATE: UseTFFdataPort NUMERIC "0"
175
// Retrieval info: PRIVATE: nBit NUMERIC "1"
176
// Retrieval info: CONSTANT: LPM_FFTYPE STRING "DFF"
177
// Retrieval info: CONSTANT: LPM_TYPE STRING "LPM_FF"
178
// Retrieval info: CONSTANT: LPM_WIDTH NUMERIC "1"
179
// Retrieval info: USED_PORT: aclr 0 0 0 0 INPUT NODEFVAL aclr
180
// Retrieval info: USED_PORT: aset 0 0 0 0 INPUT NODEFVAL aset
181
// Retrieval info: USED_PORT: clock 0 0 0 0 INPUT NODEFVAL clock
182
// Retrieval info: USED_PORT: data 0 0 0 0 INPUT NODEFVAL data
183
// Retrieval info: USED_PORT: q 0 0 0 0 OUTPUT NODEFVAL q
184
// Retrieval info: CONNECT: @clock 0 0 0 0 clock 0 0 0 0
185
// Retrieval info: CONNECT: q 0 0 0 0 @q 0 0 1 0
186
// Retrieval info: CONNECT: @aclr 0 0 0 0 aclr 0 0 0 0
187
// Retrieval info: CONNECT: @aset 0 0 0 0 aset 0 0 0 0
188
// Retrieval info: CONNECT: @data 0 0 1 0 data 0 0 0 0
189
// Retrieval info: LIBRARY: lpm lpm.lpm_components.all
190
// Retrieval info: GEN_FILE: TYPE_NORMAL dff_sr.v TRUE
191
// Retrieval info: GEN_FILE: TYPE_NORMAL dff_sr.inc FALSE
192
// Retrieval info: GEN_FILE: TYPE_NORMAL dff_sr.cmp FALSE
193
// Retrieval info: GEN_FILE: TYPE_NORMAL dff_sr.bsf FALSE
194
// Retrieval info: GEN_FILE: TYPE_NORMAL dff_sr_inst.v FALSE
195
// Retrieval info: GEN_FILE: TYPE_NORMAL dff_sr_bb.v FALSE
196
// Retrieval info: LIB_FILE: lpm
197
 
198
 
199
`else
200
 
201
 
202
module dff_sr ( aclr, aset, clock, data, q);
203
 
204
    input         aclr;
205
    input         aset;
206
    input         clock;
207
    input         data;
208
    output reg    q;
209
 
210
   always @ (posedge clock or posedge aclr or posedge aset)
211
     if (aclr)
212
       q <= 1'b0;
213
     else if (aset)
214
       q <= 1'b1;
215
     else
216
       q <= data;
217
 
218
endmodule
219
 
220
`endif

powered by: WebSVN 2.1.0

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