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

Subversion Repositories oms8051mini

[/] [oms8051mini/] [trunk/] [example/] [systemverilog/] [assertion/] [ovl/] [fifo/] [fifo_tb.v] - Blame information for rev 30

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

Line No. Rev Author Line
1 13 dinesha
module fifo_tb ();
2
parameter DATA_WIDTH = 8;
3
// Limit depth to 8
4
parameter ADDR_WIDTH = 3;
5
 
6
reg clk, rst, rd_en, wr_en;
7
reg [DATA_WIDTH-1:0] data_in ;
8
wire [DATA_WIDTH-1:0] data_out ;
9
wire empty, full;
10
integer i;
11
 
12
initial begin
13
  $monitor ("%g wr:%h wr_data:%h rd:%h rd_data:%h",
14
    $time, wr_en, data_in,  rd_en, data_out);
15
  clk = 0;
16
  rst = 0;
17
  rd_en = 0;
18
  wr_en = 0;
19
  data_in = 0;
20
  #5 rst = 1;
21
  #5 rst = 0;
22
  @ (negedge clk);
23
  wr_en = 1;
24
  // We are causing over flow
25
  for (i = 0 ; i < 10; i = i + 1) begin
26
     data_in  = i;
27
     @ (negedge clk);
28
  end
29
  wr_en  = 0;
30
  @ (negedge clk);
31
  rd_en = 1;
32
  // We are causing under flow 
33
  for (i = 0 ; i < 10; i = i + 1) begin
34
     @ (negedge clk);
35
  end
36
  rd_en = 0;
37
  #100 $finish;
38
end
39
 
40
always #1 clk = !clk;
41
 
42
syn_fifo #(DATA_WIDTH,ADDR_WIDTH) fifo(
43
.clk      (clk)     , // Clock input
44
.rst      (rst)     , // Active high reset
45
.wr_cs    (1'b1)    , // Write chip select
46
.rd_cs    (1'b1)    , // Read chipe select
47
.data_in  (data_in) , // Data input
48
.rd_en    (rd_en)   , // Read enable
49
.wr_en    (wr_en)   , // Write Enable
50
.data_out (data_out), // Data Output
51
.empty    (empty)   , // FIFO empty
52
.full     (full)      // FIFO full
53
);
54
 
55
endmodule

powered by: WebSVN 2.1.0

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