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

Subversion Repositories hpdmc

[/] [hpdmc/] [trunk/] [hpdmc_ddr32/] [test/] [iddr2.v] - Blame information for rev 21

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 21 lekernel
///////////////////////////////////////////////////////////////////////////////
2
// Copyright (c) 1995/2004 Xilinx, Inc.
3
// All Right Reserved.
4
///////////////////////////////////////////////////////////////////////////////
5
// Modified for HPDMC simulation, based on Xilinx 04/08/09 revision
6
///////////////////////////////////////////////////////////////////////////////
7
 
8
 
9
`timescale  1 ps / 1 ps
10
 
11
module IDDR2 (Q0, Q1, C0, C1, CE, D, R, S);
12
 
13
    output Q0;
14
    output Q1;
15
 
16
    input C0;
17
    input C1;
18
    input CE;
19
    input D;
20
 
21
    input R;
22
    input S;
23
 
24
    parameter DDR_ALIGNMENT = "NONE";
25
    parameter INIT_Q0 = 1'b0;
26
    parameter INIT_Q1 = 1'b0;
27
    parameter SRTYPE = "SYNC";
28
 
29
    pullup   P1 (CE);
30
    pulldown P2 (R);
31
    pulldown P3 (S);
32
 
33
    reg q0_out, q1_out;
34
    reg q0_out_int, q1_out_int;
35
    reg q0_c0_out_int, q1_c0_out_int;
36
 
37
    wire PC0, PC1;
38
 
39
    buf buf_q0 (Q0, q0_out);
40
    buf buf_q1 (Q1, q1_out);
41
 
42
 
43
    initial begin
44
 
45
        if ((INIT_Q0 != 1'b0) && (INIT_Q0 != 1'b1)) begin
46
            $display("Attribute Syntax Error : The attribute INIT_Q0 on IDDR2 instance %m is set to %d.  Legal values for this attribute are 0 or 1.", INIT_Q0);
47
            $finish;
48
        end
49
 
50
        if ((INIT_Q1 != 1'b0) && (INIT_Q1 != 1'b1)) begin
51
            $display("Attribute Syntax Error : The attribute INIT_Q0 on IDDR2 instance %m is set to %d.  Legal values for this attribute are 0 or 1.", INIT_Q1);
52
            $finish;
53
        end
54
 
55
        if ((DDR_ALIGNMENT != "C1") && (DDR_ALIGNMENT != "C0") && (DDR_ALIGNMENT != "NONE")) begin
56
            $display("Attribute Syntax Error : The attribute DDR_ALIGNMENT on IDDR2 instance %m is set to %s.  Legal values for this attribute are C0, C1 or NONE.", DDR_ALIGNMENT);
57
            $finish;
58
        end
59
 
60
        if ((SRTYPE != "ASYNC") && (SRTYPE != "SYNC")) begin
61
            $display("Attribute Syntax Error : The attribute SRTYPE on IDDR2 instance %m is set to %s.  Legal values for this attribute are ASYNC or SYNC.", SRTYPE);
62
            $finish;
63
        end
64
 
65
    end // initial begin
66
 
67
    assign PC0 = ((DDR_ALIGNMENT== "C0") || (DDR_ALIGNMENT== "NONE"))?  C0 : C1;
68
    assign PC1 = ((DDR_ALIGNMENT== "C0") || (DDR_ALIGNMENT== "NONE"))?  C1 : C0;
69
 
70
    initial begin
71
        assign q0_out_int = INIT_Q0;
72
        assign q1_out_int = INIT_Q1;
73
        assign q0_c0_out_int = INIT_Q0;
74
        assign q1_c0_out_int = INIT_Q1;
75
    end
76
 
77
    always @(R or S) begin
78
 
79
            deassign q0_out_int;
80
            deassign q1_out_int;
81
            deassign q0_c0_out_int;
82
            deassign q1_c0_out_int;
83
 
84
            if (SRTYPE == "ASYNC") begin
85
                if (R == 1) begin
86
                    assign q0_out_int = 0;
87
                    assign q1_out_int = 0;
88
                    assign q0_c0_out_int = 0;
89
                    assign q1_c0_out_int = 0;
90
                end
91
                else if (R == 0 && S == 1) begin
92
                    assign q0_out_int = 1;
93
                    assign q1_out_int = 1;
94
                end
95
            end // if (SRTYPE == "ASYNC")
96
 
97
    end // always @ (GSR or R or S)
98
 
99
 
100
    always @(posedge PC0) begin
101
        if (R == 1 && SRTYPE == "SYNC") begin
102
            q0_out_int <= 0;
103
            q0_c0_out_int <= 0;
104
            q1_c0_out_int <= 0;
105
        end
106
        else if (R == 0 && S == 1 && SRTYPE == "SYNC") begin
107
            q0_out_int <= 1;
108
        end
109
        else if (CE == 1 && R == 0 && S == 0) begin
110
            q0_out_int <= D;
111
            q0_c0_out_int <= q0_out_int;
112
            q1_c0_out_int <= q1_out_int;
113
        end
114
    end // always @ (posedge PC0)
115
 
116
 
117
    always @(posedge PC1) begin
118
        if (R == 1 && SRTYPE == "SYNC") begin
119
            q1_out_int <= 0;
120
        end
121
        else if (R == 0 && S == 1 && SRTYPE == "SYNC") begin
122
            q1_out_int <= 1;
123
        end
124
        else if (CE == 1 && R == 0 && S == 0) begin
125
            q1_out_int <= D;
126
        end
127
    end // always @ (posedge PC1)
128
 
129
 
130
    always @(q0_out_int or q1_out_int or q1_c0_out_int or q0_c0_out_int) begin
131
 
132
        case (DDR_ALIGNMENT)
133
            "NONE" : begin
134
                       q0_out <= q0_out_int;
135
                       q1_out <= q1_out_int;
136
                     end
137
            "C0" : begin
138
                       q0_out <= q0_out_int;
139
                       q1_out <= q1_c0_out_int;
140
                   end
141
            "C1" : begin
142
                       q0_out <= q0_out_int;
143
                       q1_out <= q1_c0_out_int;
144
                   end
145
        endcase // case(DDR_ALIGNMENT)
146
 
147
    end // always @ (q0_out_int or q1_out_int or q1_c0_out_int or q0_c0_out_int)
148
 
149
 
150
    specify
151
 
152
        if (C0) (C0 => Q0) = (100, 100);
153
        if (C0) (C0 => Q1) = (100, 100);
154
        if (C1) (C1 => Q1) = (100, 100);
155
        if (C1) (C1 => Q0) = (100, 100);
156
        specparam PATHPULSE$ = 0;
157
 
158
    endspecify
159
 
160
endmodule // IDDR2
161
 

powered by: WebSVN 2.1.0

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