OpenCores
URL https://opencores.org/ocsvn/fpga-cf/fpga-cf/trunk

Subversion Repositories fpga-cf

[/] [fpga-cf/] [trunk/] [hdl/] [PATLPP/] [patlpp_tb.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 peteralieb
// PATLPP Testbench
2
//
3
 
4
`timescale 1ns / 100ps
5
 
6
module patlpp_tb;
7
 
8
reg                             en; // module enable
9
reg                             clk; // module clock
10
reg                             rst; // module reset
11
 
12
reg                             in_sof; // start of frame input
13
reg                             in_eof; // end of frame input
14
reg                             in_src_rdy; // source of input ready
15
wire                            in_dst_rdy; // this module destination ready
16
 
17
wire                            out_sof; // start of frame output
18
wire                            out_eof; // end of frame output
19
wire                            out_src_rdy; // this module source ready
20
reg                             out_dst_rdy; // destination of output ready
21
 
22
wire    [7:0]            in_data; // data input
23
wire    [7:0]            out_data; // data output
24
wire    [3:0]            port_addr;
25
 
26
patlpp thepp
27
(
28
        .en(en),
29
        .clk(clk),
30
        .rst(rst),
31
        .in_sof(in_sof),
32
        .in_eof(in_eof),
33
        .in_src_rdy(in_src_rdy),
34
        .in_dst_rdy(in_dst_rdy),
35
        .out_sof(out_sof),
36
        .out_eof(out_eof),
37
        .out_src_rdy(out_src_rdy),
38
        .out_dst_rdy(out_dst_rdy),
39
        .in_data(in_data),
40
        .out_data(out_data),
41
        .port_addr(port_addr)
42
);
43
 
44
reg [7:0] mem [0:255];
45
reg [7:0] addr;
46
 
47
assign in_data = mem[addr];
48
 
49
initial $readmemh("inframe.hex", mem);
50
 
51
initial
52
begin
53
        clk = 0;
54
        en = 1;
55
        rst = 1;
56
        in_sof = 0;
57
        in_eof = 0;
58
        in_src_rdy = 0;
59
        out_dst_rdy = 1;
60
        addr = 0;
61
 
62
        @(posedge clk);
63
        rst = 0;
64
        @(posedge clk);
65
        @(posedge clk);
66
        @(posedge clk);
67
        in_src_rdy = 1;
68
        in_sof = 1;
69
end
70
 
71
always @(posedge clk)
72
begin
73
        if (in_src_rdy == 1 && in_dst_rdy == 1)
74
        begin
75
                if (addr == 0)
76
                begin
77
                        in_sof <= 0;
78
                end
79
                if (addr == 56)
80
                begin
81
                        in_eof <= 1;
82
                end
83
                if (addr == 57)
84
                begin
85
                        in_eof <= 0;
86
                end
87
                addr <= addr + 1;
88
        end
89
end
90
 
91
always #10 clk = ~clk;
92
 
93
endmodule

powered by: WebSVN 2.1.0

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