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

Subversion Repositories spimaster

[/] [spimaster/] [trunk/] [bench/] [testHarness.v] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 sfielding
`include "timescale.v"
2
 
3
module testHarness(     );
4
 
5
 
6
// -----------------------------------
7
// Local Wires
8
// -----------------------------------
9
reg clk;
10
reg rst;
11
reg spiSysClk;
12
wire [7:0] adr;
13
wire [7:0] masterDout;
14
wire [7:0] masterDin;
15
wire stb;
16
wire we;
17
wire ack;
18
wire spiClk;
19
wire spiMasterDataIn;
20
wire spiMasterDataOut;
21
wire spiCS_n;
22
 
23
 
24
initial begin
25
$dumpfile("wave.vcd");
26
$dumpvars(0, u_spiMaster);
27
end
28
 
29
spiMaster u_spiMaster (
30
  //Wishbone bus
31
  .clk_i(clk),
32
  .rst_i(rst),
33
  .address_i(adr),
34
  .data_i(masterDout),
35
  .data_o(masterDin),
36
  .strobe_i(stb),
37
  .we_i(we),
38
  .ack_o(ack),
39
 
40
  // SPI logic clock
41
  .spiSysClk(spiSysClk),
42
 
43
  //SPI bus
44
  .spiClkOut(spiClk),
45
  .spiDataIn(spiMasterDataIn),
46
  .spiDataOut(spiMasterDataOut),
47
  .spiCS_n(spiCS_n)
48
);
49
 
50
wb_master_model #(.dwidth(8), .awidth(8)) u_wb_master_model (
51
  .clk(clk),
52
  .rst(rst),
53
  .adr(adr),
54
  .din(masterDin),
55
  .dout(masterDout),
56
  .cyc(),
57
  .stb(stb),
58
  .we(we),
59
  .sel(),
60
  .ack(ack),
61
  .err(1'b0),
62
  .rty(1'b0)
63
);
64
 
65
sdModel u_sdModel (
66
  .spiClk(spiClk),
67
  .spiDataIn(spiMasterDataOut),
68
  .spiDataOut(spiMasterDataIn),
69
  .spiCS_n(spiCS_n)
70
);
71
//--------------- reset ---------------
72
initial begin
73
  @(posedge clk);
74
  @(posedge clk);
75
  @(posedge clk);
76
  @(posedge clk);
77
  @(posedge clk);
78
  @(posedge clk);
79
  @(posedge clk);
80
  @(posedge clk);
81
  rst <= 1'b1;
82
  @(posedge clk);
83
  rst <= 1'b0;
84
  @(posedge clk);
85
end
86
 
87
// ******************************  Clock section  ******************************
88
`define CLK_50MHZ_HALF_PERIOD 10
89
`define CLK_25MHZ_HALF_PERIOD 20
90
 
91
always begin
92
  #`CLK_25MHZ_HALF_PERIOD clk <= 1'b0;
93
  #`CLK_25MHZ_HALF_PERIOD clk <= 1'b1;
94
end
95
 
96
always begin
97
  #`CLK_50MHZ_HALF_PERIOD spiSysClk <= 1'b0;
98
  #`CLK_50MHZ_HALF_PERIOD spiSysClk <= 1'b1;
99
end
100
 
101
 
102
 
103
 
104
endmodule
105
 

powered by: WebSVN 2.1.0

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