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

Subversion Repositories ethmac10g

[/] [ethmac10g/] [tags/] [V10/] [rtl/] [verilog/] [tx_engine/] [ack_counter.v] - Blame information for rev 39

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

Line No. Rev Author Line
1 39 fisher5090
module ack_counter (
2
clock , // 156 MHz clock
3
reset , // active high, asynchronous Reset input
4
ready,
5
tx_start , // Active high tx_start signal for counter
6
max_count, //16 bit reg for the maximum count to generate the ack signal
7
tx_ack  // Active high signal
8
);
9
 
10
// Ports declaration
11
input clock;
12
input reset;
13
input ready;
14
input tx_start;
15
input [15:0] max_count;
16
 
17
output tx_ack;
18
 
19
// Wire connections
20
//Input
21
wire clock;
22
wire reset;
23
wire ready;
24
wire tx_start;
25
wire [15:0] max_count;
26
 
27
//Output
28
reg tx_ack;
29
 
30
 
31
 
32
//Internal wires
33
reg start_count;
34
reg start_count_del;
35
reg [15:0] counter;
36
 
37
 
38
always @ (reset or tx_start or counter or max_count)
39
begin
40
 
41
  if (reset) begin
42
    start_count <= 0;
43
  end
44
 
45
  else if (tx_start) begin
46
    start_count <= 1;
47
  end
48
 
49
  else if ((counter == max_count) & !ready) begin  //& !ready
50
    start_count <= 0;
51
  end
52
 
53
end
54
 
55
 
56
always @ (posedge clock or posedge reset)
57
begin
58
 
59
  if (reset) begin
60
    counter <= 0;
61
  end
62
 
63
  else if (counter == max_count) begin
64
    counter <= 0;
65
  end
66
 
67
  else if (start_count) begin
68
    counter <= counter + 1;
69
  end
70
 
71
end
72
 
73
 
74
always @ (posedge clock or posedge reset)
75
begin
76
 
77
  if (reset) begin
78
    start_count_del <= 0;
79
    tx_ack <= 0;
80
  end
81
  else begin
82
    start_count_del <= start_count;
83
    tx_ack <= ~start_count & start_count_del;
84
  end
85
 
86
end
87
 
88
endmodule // End of Module 
89
 

powered by: WebSVN 2.1.0

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