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

Subversion Repositories nysa_sata

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 cospan
module test_in (
2
  input               clk,
3
  input               rst,
4
 
5
  input               enable,
6
  output  reg         finished,
7
  input       [23:0]  write_count,
8
 
9
  input       [1:0]   ready,
10
  output  reg [1:0]   activate,
11
  output  reg [31:0]  fifo_data,
12
  input       [23:0]  fifo_size,
13
  output  reg         strobe
14
);
15
 
16
 
17
//Parameters
18
//Registers/Wires
19
reg           [23:0]  count;
20
reg           [23:0]  total_count;
21
//Sub modules
22
//Asynchronous Logic
23
//Synchronous Logic
24
 
25
always @ (posedge clk or posedge rst) begin
26
  if (rst) begin
27
    activate            <=  0;
28
    fifo_data           <=  0;
29
    strobe              <=  0;
30
    count               <=  0;
31
    total_count         <=  0;
32
    finished            <=  0;
33
  end
34
  else begin
35
    strobe              <=  0;
36
    if (!enable) begin
37
        total_count     <=  0;
38
        activate        <=  0;
39
        finished        <=  0;
40
    end
41
    else if (total_count < write_count) begin
42
      if ((ready > 0) && (activate == 0)) begin
43
        //A FIFO is available
44
        count             <=  0;
45
        if (ready[0]) begin
46
          activate[0]     <=  1;
47
        end
48
        else begin
49
          activate[1]     <=  1;
50
        end
51
      end
52
      else if ((activate > 0) && (count < fifo_size))begin
53
        fifo_data         <=  total_count;
54
        total_count       <=  total_count + 1;
55
        count             <=  count + 1;
56
        strobe            <=  1;
57
      end
58
      else begin
59
        activate          <=  0;
60
      end
61
    end
62
    else begin
63
        finished          <=  1;
64
        activate          <=  0;
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.