OpenCores
URL https://opencores.org/ocsvn/systemverilog-uart16550/systemverilog-uart16550/trunk

Subversion Repositories systemverilog-uart16550

[/] [systemverilog-uart16550/] [trunk/] [rtl/] [fifo_interface.sv] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 hiroshi
/* *****************************************************************************
2
   * title:         uart_16550_rll module                                      *
3
   * description:   RS232 Protocol 16550D uart (mostly supported)              *
4
   * languages:     systemVerilog                                              *
5
   *                                                                           *
6
   * Copyright (C) 2010 miyagi.hiroshi                                         *
7
   *                                                                           *
8
   * This library is free software; you can redistribute it and/or             *
9
   * modify it under the terms of the GNU Lesser General Public                *
10
   * License as published by the Free Software Foundation; either              *
11
   * version 2.1 of the License, or (at your option) any later version.        *
12
   *                                                                           *
13
   * This library is distributed in the hope that it will be useful,           *
14
   * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
15
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
16
   * Lesser General Public License for more details.                           *
17
   *                                                                           *
18
   * You should have received a copy of the GNU Lesser General Public          *
19
   * License along with this library; if not, write to the Free Software       *
20
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111*1307  USA *
21
   *                                                                           *
22
   *         ***  GNU LESSER GENERAL PUBLIC LICENSE  ***                       *
23
   *           from http://www.gnu.org/licenses/lgpl.txt                       *
24
   *****************************************************************************
25
   *                            redleaflogic,ltd                               *
26
   *                    miyagi.hiroshi@redleaflogic.biz                        *
27
   *          $Id: fifo_interface.sv 108 2010-03-30 02:56:26Z hiroshi $         *
28
   ***************************************************************************** */
29
 
30
`ifdef SYN
31
/* empty */
32
`else
33
timeunit      1ps ;
34
timeprecision 1ps ;
35
`endif
36
 
37
import fifo_package::* ;
38
interface fifo_bus(input clk_i) ;
39
   //   wire [DATA_WIDTH-1:0] push_dat ;
40
   //   wire [DATA_WIDTH-1:0] pop_dat ;
41
   wire [10:0]           push_dat ;
42
   wire [10:0]           pop_dat ;
43
   wire                  push ;
44
   wire                  pop ;
45
   wire                  empty ;
46
   wire                  full ;
47
   wire                  almost_full ;
48
 
49
   modport push_master_mp (
50
                           output push_dat, push,
51
                           input  full, almost_full
52
                           ) ;
53
 
54
   modport push_slave_mp (
55
                          input  push_dat, push,
56
                          output full, almost_full, empty
57
                          ) ;
58
 
59
   modport pop_master_mp (
60
                          output pop,
61
                          input  pop_dat, empty, almost_full, full
62
                          ) ;
63
 
64
   modport pop_slave_mp (
65
                         input  pop,
66
                         output pop_dat, empty, almost_full, full
67
                         ) ;
68
 
69
`ifdef SIM
70
   import fifo_be_package:: * ;
71
 
72
   logic [10:0]                 pop_d ;
73
   logic [10:0]                 push_d ;
74
   logic                        pop_en;
75
   logic                        push_en ;
76
   logic [10:0]                 data ;
77
 
78
   assign push_dat = push_d ;
79
   assign push     = push_en ;
80
   assign pop_d    = pop_dat ;
81
   assign pop      = pop_en ;
82
 
83
   initial begin
84
      push_d = 0 ;
85
      pop_en = 0 ;
86
      push_en = 0 ;
87
   end
88
 
89
   task burst_read(output logic [10:0] data) ;
90
      @(posedge clk_i) ;
91
      #(STEP*0.1) ;
92
      data = pop_d ;
93
      pop_en = 1'b1 ;
94
   endtask // read
95
 
96
   task burst_write(input logic [10:0] data) ;
97
      @(posedge clk_i) ;
98
      #(STEP*0.1) ;
99
      push_d  = data ;
100
      push_en = 1'b1 ;
101
   endtask // write
102
 
103
   task read(output logic [10:0] data) ;
104
      @(posedge clk_i) ;
105
      #(STEP*0.1) ;
106
      data = pop_d ;
107
      pop_en = 1'b1 ;
108
      @(posedge clk_i) ;
109
      #(STEP*0.1) ;
110
      pop_en = 1'b0 ;
111
   endtask // read
112
 
113
   task write(input logic [10:0] data) ;
114
      @(posedge clk_i) ;
115
      #(STEP*0.1) ;
116
      push_d  = data ;
117
      push_en = 1'b1 ;
118
      @(posedge clk_i) ;
119
      #(STEP*0.1) ;
120
      push_d  = 'hxx ;
121
      push_en = 1'b0 ;
122
   endtask // write
123
 
124
   task nop() ;
125
      @(posedge clk_i) ;
126
      #(STEP*0.1) ;
127
      push_d  = 11'hxxx ;
128
      pop_en  = 1'b0 ;
129
      push_en = 1'b0 ;
130
   endtask // write
131
 
132
`endif //  `ifdef SIM
133
 
134
endinterface : fifo_bus
135
 

powered by: WebSVN 2.1.0

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