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

Subversion Repositories nysa_sata

[/] [nysa_sata/] [trunk/] [sim/] [test_out.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 cospan
module test_out (
2
  input               clk,
3
  input               rst,
4
 
5
  input               enable,
6
  output  reg         busy,
7
  output  reg         error,
8
 
9
  input               ready,
10
  output  reg         activate,
11
  input       [23:0]  size,
12
  input       [31:0]  data,
13
  output  reg         strobe,
14
  output  reg [23:0]  total_count
15
 
16
);
17
 
18
reg           [31:0]  test_value;
19
reg           [23:0]  count;
20
 
21
always @ (posedge clk) begin
22
  if (rst) begin
23
    activate          <=  0;
24
    count             <=  0;
25
    test_value        <=  32'h0;
26
    error             <=  0;
27
    busy              <=  0;
28
    total_count       <=  0;
29
    strobe            <=  0;
30
  end
31
  else begin
32
    busy              <=  0;
33
    strobe            <=  0;
34
    //The user is not asking to check anything
35
    if (!enable) begin
36
      //activate        <=  0;
37
      //count           <=  0;
38
      test_value      <=  32'h0;
39
      error           <=  0;
40
      total_count     <=  0;
41
    end
42
 
43
    //Looking for total count
44
    //busy            <=  1;
45
    if (ready && !activate) begin
46
      count         <=  0;
47
      activate      <=  1;
48
    end
49
    else if (activate) begin
50
      busy            <= 1;
51
      if (count < size) begin
52
        strobe      <=  1;
53
        total_count <=  total_count + 1;
54
        count       <=  count + 1;
55
        if ((data != test_value) && enable) begin
56
          error     <=  1;
57
        end
58
      end
59
      else begin
60
        activate  <=  0;
61
      end
62
    end
63
    if (strobe) begin
64
      test_value  <= test_value + 1;
65
    end
66
  end
67
end
68
 
69
endmodule

powered by: WebSVN 2.1.0

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