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

Subversion Repositories openriscdevboard

[/] [openriscdevboard/] [trunk/] [cyc2-openrisc/] [bench/] [testHarness.v] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 sfielding
`timescale 1ns/1ns
2
module testHarness(     );
3
 
4
 
5
// -----------------------------------
6
// Local Wires
7
// -----------------------------------
8
wire uart_srx;
9
wire uart_stx;
10
reg rst_n;
11
wire jtag_tdi;
12
wire jtag_tdo;
13
wire jtag_tck;
14
reg clk;
15
reg baudClk;
16
wire jtag_tms;
17
wire jtag_trst;
18
wire [11:0] mc_addr;
19
wire [1:0] mc_ba;
20
wire [31:0] mc_dq;
21
wire [3:0] mc_dqm;
22
wire mc_we_;
23
wire mc_cas_;
24
wire mc_ras_;
25
wire mc_cke_;
26
wire sdram_cs;
27
wire sdram_clk;
28
 
29
initial begin
30
  $dumpfile("wave.vcd");
31
  $dumpvars(0, i_cyc_or12_mini_top);
32
  //$dumpvars(0, u_uart_rx);
33
end
34
 
35
// -----------------------------------
36
// Instance of Module: cyc_or12_mini_top
37
// -----------------------------------
38
cyc_or12_mini_top i_cyc_or12_mini_top(
39
                .clk(clk),
40
 
41
        //
42
        // UART signals
43
        //
44
                .uart_stx(uart_stx),
45
                .uart_srx(uart_srx),
46
 
47
        //
48
        // JTAG signals
49
        //
50
                .jtag_tdi(jtag_tdi),
51
                .jtag_tms(jtag_tms),
52
                .jtag_tck(jtag_tck),
53
                .jtag_trst(jtag_trst),
54
                .jtag_tdo(jtag_tdo),
55
 
56
        //
57
        // SDRAM
58
        //
59
                .mc_addr(mc_addr),
60
                .mc_ba(mc_ba),
61
                .mc_dq(mc_dq),
62
                .mc_dqm(mc_dqm),
63
                .mc_we_(mc_we_),
64
                .mc_cas_(mc_cas_),
65
                .mc_ras_(mc_ras_),
66
                .mc_cke_(mc_cke_),
67
                .sdram_cs(sdram_cs),
68
                .sdram_clk(sdram_clk)
69
        );
70
 
71
mt48lc2m32b2 u_mt48lc2m32b2 (
72
  .Dq(mc_dq),
73
  .Addr(mc_addr[10:0]),
74
  .Ba(mc_ba),
75
  .Clk(sdram_clk),
76
  .Cke(mc_cke_),
77
  .Cs_n(sdram_cs),
78
  .Ras_n(mc_ras_),
79
  .Cas_n(mc_cas_),
80
  .We_n(mc_we_),
81
  .Dqm(mc_dqm)
82
);
83
 
84
assign jtag_tms = 1'b0;
85
assign jtag_tdi = 1'b0;
86
assign jtag_tck = 1'b0;
87
assign jtag_trst = 1'b1;
88
 
89
uart_rx u_uart_rx (
90
  .reset(~rst_n),
91
  .rxclk(baudClk),
92
  .rx_in(uart_stx)
93
);
94
 
95
//--------------- reset ---------------
96
initial begin
97
  @(posedge clk);
98
  @(posedge clk);
99
  @(posedge clk);
100
  @(posedge clk);
101
  @(posedge clk);
102
  @(posedge clk);
103
  @(posedge clk);
104
  @(posedge clk);
105
  rst_n <= 1'b0;
106
  @(posedge clk);
107
  rst_n <= 1'b1;
108
  @(posedge clk);
109
end
110
 
111
// ******************************  Clock section  ******************************
112
`define CLK_50MHZ_HALF_PERIOD 10
113
always begin
114
  #`CLK_50MHZ_HALF_PERIOD clk <= 1'b0;
115
  #`CLK_50MHZ_HALF_PERIOD clk <= 1'b1;
116
end
117
 
118
// generate 16 * baud clock
119
// baud clock = 115200 * 16
120
// Actual baud clock is slower because we are not using the PLL
121
// to generate the 30MHz Wish bone clock. Instead the Wishbone clock is 25MHz
122
// So baud clock = 115200 * 16 * (25/30)
123
`define CLK_BAUD_HALF_PERIOD 322
124
always begin
125
  #`CLK_BAUD_HALF_PERIOD baudClk <= 1'b0;
126
  #`CLK_BAUD_HALF_PERIOD baudClk <= 1'b1;
127
end
128
 
129
 
130
 
131
endmodule
132
 

powered by: WebSVN 2.1.0

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