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

Subversion Repositories ssbcc

[/] [ssbcc/] [trunk/] [core/] [9x8/] [peripherals/] [tb/] [outFIFO_async/] [tb.v] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 sinclairrf
/*******************************************************************************
2
 *
3
 * Copyright 2013, Sinclair R.F., Inc.
4
 *
5
 * Test bench for outFIFO_async peripheral.
6
 *
7
 ******************************************************************************/
8
 
9
`timescale 1ns/1ps
10
 
11
module tb;
12
 
13
// 100 MHz processor clock
14
reg s_clk = 1'b1;
15
always @ (s_clk)
16
  s_clk <= #5 ~s_clk;
17
 
18
// synchronous processor reset
19
reg s_rst = 1'b1;
20
initial begin
21
  repeat (5) @ (posedge s_clk);
22
  s_rst = 1'b0;
23
end
24
 
25
// 250 MHz data readout clock
26
reg s_fast_clk = 1'b1;
27
always @ (s_fast_clk)
28
  s_fast_clk <= #2 ~s_fast_clk;
29
 
30
// enable the data readout after a delay
31
reg s_readout_en = 1'b0;
32
initial begin
33
  repeat(25*40) @ (posedge s_fast_clk);
34
  s_readout_en <= 1'b1;
35
end
36
 
37
//
38
// Instantiate the processor.
39
//
40
 
41
wire      [7:0] s_diag;
42
wire            s_empty;
43
wire            s_done;
44
 
45
wire            s_diag_rd = ~s_empty && s_readout_en;
46
reg             s_empty_clk = 1'b0;
47
 
48
tb_outFIFO_async uut(
49
  // synchronous reset and processor clock
50
  .i_rst        (s_rst),
51
  .i_clk        (s_clk),
52
  // asynchronous output FIFO
53
  .i_aclk       (s_fast_clk),
54
  .o_data       (s_diag),
55
  .i_data_rd    (s_diag_rd),
56
  .o_data_empty (s_empty),
57
  // feed-back empty condition
58
  .i_empty      (s_empty_clk),
59
  // termination signal
60
  .o_done       (s_done)
61
);
62
 
63
always @ (posedge s_clk)
64
  s_empty_clk <= s_empty;
65
 
66
// validation output
67
always @ (posedge s_fast_clk)
68
  if (s_diag_rd)
69
    $display("%12d : %h", $time, s_diag);
70
 
71
// termination signal
72
always @ (posedge s_clk)
73
  if (s_done)
74
    $finish;
75
 
76
endmodule

powered by: WebSVN 2.1.0

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