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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [common/] [opencores.org/] [Testbench/] [bfms/] [micro_bus_model/] [rtl/] [verilog/] [top.sim] - Blame information for rev 133

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 131 jt_eaton
 
2
 
3 133 jt_eaton
  always@(posedge clk)
4 131 jt_eaton
  if(reset)
5
    begin
6
      addr  <= 16'h0000;
7
      wdata <=  8'h00;
8
      wr    <=  1'b0;
9
      rd    <=  1'b0;
10
      cs    <=  1'b1;
11
      exp_rdata    <=  8'h00;
12
      mask_rdata    <=  8'h00;
13
   end
14
 
15
 
16
 
17
 
18
 
19 133 jt_eaton
 
20 131 jt_eaton
  // Tasks
21
 
22
 
23
 
24
task automatic next;
25
  input [31:0] num;
26
  repeat (num)       @ (posedge clk);
27
endtask // next
28
 
29
 
30
 
31
 
32
 
33
  // write cycle
34
  task u_write;
35
    input [addr_width-1:0] a;
36
    input  [7:0] d;
37
 
38
    begin
39
 
40
      $display("%t %m cycle %x %x",$realtime,a,d );
41
 
42
      addr  <= a;
43
      wdata <= d;
44
      rd    <= 1'b0;
45
      wr    <= 1'b1;
46
      next(1);
47
 
48
      wr     <= 1'b0;
49
      next(1);
50
 
51
    end
52
  endtask
53
 
54
  // read cycle
55
  task u_read;
56
    input   [addr_width-1:0]  a;
57
    output  [7:0]   d;
58
 
59
     begin
60
 
61
      addr  <= a;
62
      wdata <= 8'h00;
63
      rd    <= 1'b1;
64
      wr    <= 1'b0;
65
      next(2);
66
 
67
      d     <= rdata;
68
      $display("%t %m  cycle %x %x",$realtime,a,rdata );
69
      rd    <= 1'b1;
70
      next(1);
71
      rd    <= 1'b0;
72
    end
73
  endtask
74
 
75
  // Compare cycle (read data from location and compare with expected data)
76
  task u_cmp;
77
    input  [addr_width-1:0] a;
78
    input  [7:0] d_exp;
79
 
80
     begin
81
      addr      <= a;
82
      wdata     <= 8'h00;
83
      rd        <= 1'b1;
84
      wr        <= 1'b0;
85
      exp_rdata <= d_exp;
86
 
87
      next(1);
88
      mask_rdata  <= 8'hff;
89
 
90
 
91
      next(1);
92
      $display("%t %m   cycle %x %x",$realtime,a,d_exp );
93
      mask_rdata <= 8'h00;
94
      rd         <= 1'b0;
95
 
96
   end
97
  endtask
98
 
99
 

powered by: WebSVN 2.1.0

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