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

Subversion Repositories openhmc

[/] [openhmc/] [trunk/] [openHMC/] [rtl/] [building_blocks/] [fifos/] [sync/] [xilinx/] [openhmc_sync_fifo_xilinx.v] - Blame information for rev 15

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 15 juko
/*
2
 *                              .--------------. .----------------. .------------.
3
 *                             | .------------. | .--------------. | .----------. |
4
 *                             | | ____  ____ | | | ____    ____ | | |   ______ | |
5
 *                             | ||_   ||   _|| | ||_   \  /   _|| | | .' ___  || |
6
 *       ___  _ __   ___ _ __  | |  | |__| |  | | |  |   \/   |  | | |/ .'   \_|| |
7
 *      / _ \| '_ \ / _ \ '_ \ | |  |  __  |  | | |  | |\  /| |  | | || |       | |
8
 *       (_) | |_) |  __/ | | || | _| |  | |_ | | | _| |_\/_| |_ | | |\ `.___.'\| |
9
 *      \___/| .__/ \___|_| |_|| ||____||____|| | ||_____||_____|| | | `._____.'| |
10
 *           | |               | |            | | |              | | |          | |
11
 *           |_|               | '------------' | '--------------' | '----------' |
12
 *                              '--------------' '----------------' '------------'
13
 *
14
 *  openHMC - An Open Source Hybrid Memory Cube Controller
15
 *  (C) Copyright 2014 Computer Architecture Group - University of Heidelberg
16
 *  www.ziti.uni-heidelberg.de
17
 *  B6, 26
18
 *  68159 Mannheim
19
 *  Germany
20
 *
21
 *  Contact: openhmc@ziti.uni-heidelberg.de
22
 *  http://ra.ziti.uni-heidelberg.de/openhmc
23
 *
24
 *   This source file is free software: you can redistribute it and/or modify
25
 *   it under the terms of the GNU Lesser General Public License as published by
26
 *   the Free Software Foundation, either version 3 of the License, or
27
 *   (at your option) any later version.
28
 *
29
 *   This source file is distributed in the hope that it will be useful,
30
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
31
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
32
 *   GNU Lesser General Public License for more details.
33
 *
34
 *   You should have received a copy of the GNU Lesser General Public License
35
 *   along with this source file.  If not, see <http://www.gnu.org/licenses/>.
36
 *
37
 *
38
 *  Module name: openhmc_sync_fifo_xilinx
39
 *
40
 */
41
 
42
`default_nettype none
43
 
44
module openhmc_sync_fifo_xilinx #(
45
`ifdef CAG_ASSERTIONS
46
                parameter DISABLE_EMPTY_ASSERT          = 0,
47
                parameter DISABLE_FULL_ASSERT           = 0,
48
                parameter DISABLE_SHIFT_OUT_ASSERT      = 0,
49
                parameter DISABLE_XCHECK_ASSERT         = 0,
50
`endif
51
                parameter DWIDTH                                        = 8
52
        ) (
53
                input wire                              clk,
54
                input wire                              res_n,
55
                input wire [DWIDTH-1:0]  d_in,
56
                input wire                              shift_in,
57
                input wire                              shift_out,
58
                output reg [DWIDTH-1:0] d_out,
59
                output wire                             full,
60
                output reg                              empty,
61
                output wire                             almost_full,
62
                output wire                             almost_empty
63
        );
64
 
65
        wire [DWIDTH-1:0]        d_out_w;
66
        wire                            empty_w;
67
        wire                            shift_out_w;
68
        wire                            shift_in_w;
69
 
70
                assign shift_out_w      = !empty_w && (empty || shift_out);
71
                assign shift_in_w       = shift_in;
72
 
73
                `ifdef ASYNC_RES
74
                always @(posedge clk or negedge res_n) `else
75
                always @(posedge clk ) `endif
76
                begin
77
                        if (!res_n)
78
                        begin
79
                                empty           <= 1'b1;
80
                                d_out           <= {DWIDTH {1'b0}};
81
                        end
82
                        else
83
                        begin
84
                                if (!empty_w && (empty || shift_out))
85
                                begin
86
                                        d_out   <= d_out_w;
87
                                        empty   <= 1'b0;
88
                                end
89
                                else if (shift_out)
90
                                        empty   <= 1'b1;
91
                        end
92
                end
93
 
94
        openhmc_srl_fifo_16 #(
95
                `ifdef CAG_ASSERTIONS
96
                        .DISABLE_EMPTY_ASSERT(DISABLE_EMPTY_ASSERT),
97
                        .DISABLE_FULL_ASSERT(DISABLE_FULL_ASSERT),
98
                `endif
99
                .DWIDTH(DWIDTH)
100
        ) srl_fifo_I (
101
                .clk(clk),
102
                .res_n(res_n),
103
                .d_in(d_in),
104
                .d_out(d_out_w),
105
                .shift_out(shift_out_w),
106
                .shift_in(shift_in_w),
107
                .full(full),
108
                .almost_full(almost_full),
109
                .empty(empty_w),
110
                .almost_empty(almost_empty)
111
        );
112
 
113
`ifdef CAG_COVERAGE
114
        full_cov:                               cover property (@(posedge clk) disable iff(!res_n) (full == 1'b1));
115
        almost_full_cov:                cover property (@(posedge clk) disable iff(!res_n) (almost_full == 1'b1));
116
        empty_cov:                              cover property (@(posedge clk) disable iff(!res_n) (empty == 1'b1));
117
        almost_empty_cov:               cover property (@(posedge clk) disable iff(!res_n) (almost_empty == 1'b1));
118
 
119
        covergroup shift_in_and_out @(posedge clk);
120
                shift_in_and_out_cp: coverpoint ({shift_in, shift_out}) iff (shift_in || shift_out)
121
                {
122
                        bins count[] = {[1:3]};
123
                }
124
        endgroup
125
        shift_in_and_out shift_in_and_out_I;
126
        initial begin
127
                shift_in_and_out_I = new();
128
                shift_in_and_out_I.set_inst_name("shift_in_and_out_I");
129
        end
130
`endif // CAG_COVERAGE
131
 
132
`ifdef CAG_ASSERTIONS
133
        shift_in_and_full:                              assert property (@(posedge clk) disable iff(!res_n) (shift_in |-> !full));
134
 
135
        if (DISABLE_SHIFT_OUT_ASSERT == 0)
136
                shift_out_and_empty:            assert property (@(posedge clk) disable iff(!res_n) (shift_out |-> !empty));
137
 
138
        if (DISABLE_XCHECK_ASSERT == 0)
139
          d_out_known:                                  assert property (@(posedge clk) disable iff(!res_n) (!empty |-> !$isunknown(d_out)));
140
 
141
        final
142
        begin
143
                if (DISABLE_FULL_ASSERT == 0)
144
                begin
145
                        assert_full_set:                                assert (!full);
146
                        assert_almost_full_set:                 assert (!almost_full);
147
                end
148
 
149
                if (DISABLE_EMPTY_ASSERT == 0)
150
                begin
151
                        assert_almost_empty_not_set:    assert (almost_empty);
152
                        assert_empty_not_set:                   assert (empty);
153
                end
154
        end
155
`endif // CAG_ASSERTIONS
156
 
157
endmodule
158
 
159
`default_nettype wire

powered by: WebSVN 2.1.0

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