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 12

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
 
47
tb_outFIFO_async uut(
48
  // synchronous reset and processor clock
49
  .i_rst        (s_rst),
50
  .i_clk        (s_clk),
51
  // asynchronous output FIFO
52
  .i_aclk       (s_fast_clk),
53
  .o_data       (s_diag),
54
  .i_data_rd    (s_diag_rd),
55
  .o_data_empty (s_empty),
56
  // termination signal
57
  .o_done       (s_done)
58
);
59
 
60
// validation output
61
always @ (posedge s_fast_clk)
62
  if (s_diag_rd)
63
    $display("%12d : %h", $time, s_diag);
64
 
65
// termination signal
66
always @ (posedge s_clk)
67
  if (s_done)
68
    $finish;
69
 
70
endmodule

powered by: WebSVN 2.1.0

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