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

Subversion Repositories uart6551

[/] [uart6551/] [trunk/] [trunk/] [rtl/] [ack_gen.v] - Blame information for rev 13

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

Line No. Rev Author Line
1 2 robfinch
// ============================================================================
2
//        __
3
//   \\__/ o\    (C) 2018-2019  Robert Finch, Waterloo
4
//    \  __ /    All rights reserved.
5
//     \/_//     robfinch<remove>@finitron.ca
6
//       ||
7
//
8
// This source file is free software: you can redistribute it and/or modify 
9
// it under the terms of the GNU Lesser General Public License as published 
10
// by the Free Software Foundation, either version 3 of the License, or     
11
// (at your option) any later version.                                      
12
//                                                                          
13
// This source file is distributed in the hope that it will be useful,      
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of           
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
16
// GNU General Public License for more details.                             
17
//                                                                          
18
// You should have received a copy of the GNU General Public License        
19
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
20
//                                                            
21
// ack_gen.v
22
// - generates a acknowledge signal after a specified number of clocks.
23
// - separate stages for read and write
24
//
25
// ============================================================================
26
//
27
module ack_gen(clk_i, ce_i, i, we_i, o);
28
input clk_i;
29
input ce_i;
30
input i;
31
input we_i;
32
output reg o;
33
parameter READ_STAGES = 3;
34
parameter WRITE_STAGES = 0;
35
parameter ACK_LEVEL = 1'b0;
36
parameter REGISTER_OUTPUT = 1'b0;
37
 
38
wire ro, wo;
39
generate begin : gRdy
40
if (READ_STAGES==0)
41
assign ro = 0;
42
else begin
43
ready_gen #(READ_STAGES) urrdy (clk_i, ce_i, i, ro);
44
end
45
if (WRITE_STAGES==0)
46
assign wo = we_i;
47
else begin
48
ready_gen #(WRITE_STAGES) uwrdy (clk_i, ce_i, we_i, wo);
49
end
50
if (REGISTER_OUTPUT) begin
51
always @(posedge clk_i)
52
        o <= we_i ? wo : (i ? ro : ACK_LEVEL);
53
end
54
else begin
55
always @*
56
        o <= we_i ? wo : (i ? ro : ACK_LEVEL);
57
end
58
end
59
endgenerate
60
 
61
endmodule

powered by: WebSVN 2.1.0

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