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

Subversion Repositories hpdmc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 21 lekernel
///////////////////////////////////////////////////////////////////////////////
2
// Copyright (c) 1995/2005 Xilinx, Inc.
3
// All Right Reserved.
4
///////////////////////////////////////////////////////////////////////////////
5
// Modified for HPDMC simulation, based on Xilinx 05/29/07 revision
6
///////////////////////////////////////////////////////////////////////////////
7
 
8
module ODDR #(
9
        parameter DDR_CLK_EDGE = "OPPOSITE_EDGE",
10
        parameter INIT = 1'b0,
11
        parameter SRTYPE = "SYNC"
12
) (
13
        output Q,
14
        input C,
15
        input CE,
16
        input D1,
17
        input D2,
18
        input R,
19
        input S
20
);
21
 
22
reg q_out = INIT, qd2_posedge_int;
23
 
24
wire c_in;
25
wire ce_in;
26
wire d1_in;
27
wire d2_in;
28
wire gsr_in;
29
wire r_in;
30
wire s_in;
31
 
32
buf buf_c(c_in, C);
33
buf buf_ce(ce_in, CE);
34
buf buf_d1(d1_in, D1);
35
buf buf_d2(d2_in, D2);
36
buf buf_q(Q, q_out);
37
buf buf_r(r_in, R);
38
buf buf_s(s_in, S);
39
 
40
initial begin
41
        if((INIT != 0) && (INIT != 1)) begin
42
                $display("Attribute Syntax Error : The attribute INIT on ODDR instance %m is set to %d.  Legal values for this attribute are 0 or 1.", INIT);
43
                $finish;
44
        end
45
 
46
        if((DDR_CLK_EDGE != "OPPOSITE_EDGE") && (DDR_CLK_EDGE != "SAME_EDGE")) begin
47
                $display("Attribute Syntax Error : The attribute DDR_CLK_EDGE on ODDR instance %m is set to %s.  Legal values for this attribute are OPPOSITE_EDGE or SAME_EDGE.", DDR_CLK_EDGE);
48
                $finish;
49
        end
50
 
51
        if((SRTYPE != "ASYNC") && (SRTYPE != "SYNC")) begin
52
                $display("Attribute Syntax Error : The attribute SRTYPE on ODDR instance %m is set to %s.  Legal values for this attribute are ASYNC or SYNC.", SRTYPE);
53
                $finish;
54
        end
55
end
56
 
57
always @(r_in, s_in) begin
58
        if(r_in == 1'b1 && SRTYPE == "ASYNC") begin
59
                assign q_out = 1'b0;
60
                assign qd2_posedge_int = 1'b0;
61
        end else if(r_in == 1'b0 && s_in == 1'b1 && SRTYPE == "ASYNC") begin
62
                assign q_out = 1'b1;
63
                assign qd2_posedge_int = 1'b1;
64
        end else if((r_in == 1'b1 || s_in == 1'b1) && SRTYPE == "SYNC") begin
65
                deassign q_out;
66
                deassign qd2_posedge_int;
67
        end else if(r_in == 1'b0 && s_in == 1'b0) begin
68
                deassign q_out;
69
                deassign qd2_posedge_int;
70
        end
71
end
72
 
73
always @(posedge c_in) begin
74
        if(r_in == 1'b1) begin
75
                q_out <= 1'b0;
76
                qd2_posedge_int <= 1'b0;
77
        end else if(r_in == 1'b0 && s_in == 1'b1) begin
78
                q_out <= 1'b1;
79
                qd2_posedge_int <= 1'b1;
80
        end else if(ce_in == 1'b1 && r_in == 1'b0 && s_in == 1'b0) begin
81
                q_out <= d1_in;
82
                qd2_posedge_int <= d2_in;
83
        end
84
end
85
 
86
always @(negedge c_in) begin
87
        if(r_in == 1'b1)
88
                q_out <= 1'b0;
89
        else if(r_in == 1'b0 && s_in == 1'b1)
90
                q_out <= 1'b1;
91
        else if(ce_in == 1'b1 && r_in == 1'b0 && s_in == 1'b0) begin
92
                if(DDR_CLK_EDGE == "SAME_EDGE")
93
                        q_out <= qd2_posedge_int;
94
                else if(DDR_CLK_EDGE == "OPPOSITE_EDGE")
95
                        q_out <= d2_in;
96
        end
97
end
98
 
99
endmodule

powered by: WebSVN 2.1.0

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