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

Subversion Repositories i2cslave

[/] [i2cslave/] [trunk/] [bench/] [testCase0.v] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 sfielding
// ---------------------------------- testcase0.v ----------------------------
2
`include "timescale.v"
3
`include "i2cSlave_define.v"
4
`include "i2cSlaveTB_defines.v"
5
 
6
module testCase0();
7
 
8
reg ack;
9
reg [7:0] data;
10
reg [15:0] dataWord;
11
reg [7:0] dataRead;
12
reg [7:0] dataWrite;
13
integer i;
14
integer j;
15
 
16
initial
17
begin
18
  $write("\n\n");
19
  testHarness.reset;
20
  #1000;
21
 
22
  // set i2c master clock scale reg PRER = (48MHz / (5 * 400KHz) ) - 1
23
  $write("Testing register read/write\n");
24
  testHarness.u_wb_master_model.wb_write(1, `PRER_LO_REG , 8'h17);
25
  testHarness.u_wb_master_model.wb_write(1, `PRER_HI_REG , 8'h00);
26
  testHarness.u_wb_master_model.wb_cmp(1, `PRER_LO_REG , 8'h17);
27
 
28
  // enable i2c master
29
  testHarness.u_wb_master_model.wb_write(1, `CTR_REG , 8'h80);
30
 
31
  multiByteReadWrite.write({`I2C_ADDRESS, 1'b0}, 8'h00, 32'h89abcdef, `SEND_STOP);
32
  multiByteReadWrite.read({`I2C_ADDRESS, 1'b0}, 8'h00, 32'h89abcdef, dataWord, `NULL);
33
  multiByteReadWrite.read({`I2C_ADDRESS, 1'b0}, 8'h04, 32'h12345678, dataWord, `NULL);
34
 
35
  $write("Finished all tests\n");
36
  $stop;
37
 
38
end
39
 
40
endmodule
41
 

powered by: WebSVN 2.1.0

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