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

Subversion Repositories fwrisc

[/] [fwrisc/] [trunk/] [ve/] [fwrisc/] [tb/] [fwrisc_tb_hdl.sv] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 mballance
/****************************************************************************
2
 * fwrisc_tb.sv
3
 ****************************************************************************/
4
 
5
/**
6
 * Module: fwrisc_tb_hdl
7
 *
8
 * Unit-level testbench for the FWRISC core
9
 */
10
module fwrisc_tb_hdl(input clock);
11
 
12
        reg reset = 1;
13
        reg [7:0] reset_cnt = 0;
14
 
15
        always @(posedge clock) begin
16
                if (reset_cnt == 10) begin
17
                        reset <= 0;
18
                end else begin
19
                        reset_cnt <= reset_cnt + 1;
20
                end
21
        end
22
 
23
        wire [31:0]                     iaddr, idata;
24
        wire                            ivalid, iready;
25
        wire [31:0]                     daddr, dwdata, drdata;
26
        wire [3:0]                      dstrb;
27
        wire                            dwrite, dvalid, dready;
28
 
29
        fwrisc u_dut (
30
                .clock   (clock  ),
31
                .reset   (reset  ),
32
                .iaddr   (iaddr  ),
33
                .idata   (idata  ),
34
                .ivalid  (ivalid ),
35
                .iready  (iready ),
36
                .daddr   (daddr  ),
37
                .dwdata  (dwdata ),
38
                .drdata  (drdata ),
39
                .dstrb   (dstrb  ),
40
                .dwrite  (dwrite ),
41
                .dvalid  (dvalid ),
42
                .dready  (dready ));
43
 
44
        assign dready = 1;
45
        assign iready = 1;
46
 
47
        generic_sram_byte_en_dualport #(
48
                .DATA_WIDTH        (32       ),
49
                .ADDRESS_WIDTH     (14       ), // 64k (4x16k)
50
                .INIT_FILE         ("ram.hex")
51
                ) u_sram (
52
                .i_clk             (clock                       ),
53
                .i_write_data_a    (32'b0                               ),
54
                .i_write_enable_a  (1'b0                                        ),
55
                .i_address_a       (iaddr[31:2]                         ),
56
                .i_byte_enable_a   (4'hf                                        ),
57
                .o_read_data_a     (idata                               ),
58
                .i_write_data_b    (dwdata                              ),
59
                .i_write_enable_b  ((dvalid && dwrite)          ),
60
                .i_address_b       (daddr[31:2]                         ),
61
                .i_byte_enable_b   (dstrb                                       ),
62
                .o_read_data_b     (drdata                                      ));
63
 
64
        bind fwrisc_tracer fwrisc_tracer_bfm u_tracer(
65
                        .clock(clock),
66
                        .reset(reset),
67
                        .addr(addr),
68
                        .instr(instr),
69
                        .ivalid(ivalid),
70
                        .raddr(raddr),
71
                        .rdata(rdata),
72
                        .rwrite(rwrite),
73
                        .maddr(maddr),
74
                        .mdata(mdata),
75
                        .mstrb(mstrb),
76
                        .mwrite(mwrite),
77
                        .mvalid(mvalid)
78
                );
79
 
80
endmodule
81
 
82
 

powered by: WebSVN 2.1.0

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