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

Subversion Repositories wb_lpc

[/] [wb_lpc/] [trunk/] [rtl/] [verilog/] [wb_dreq_host.v] - Blame information for rev 3

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

Line No. Rev Author Line
1 3 hharte
//
2
//////////////////////////////////////////////////////////////////////
3
////                                                              ////
4
////  $Id: wb_dreq_host.v,v 1.1 2008-03-02 20:46:40 hharte Exp $
5
////  wb_dreq_host.v -  Wishbone DMA Controller for LPC Host      ////
6
////                                                              ////
7
////  This file is part of the Wishbone LPC Bridge project        ////
8
////  http://www.opencores.org/projects/wb_lpc/                   ////
9
////                                                              ////
10
////  Author:                                                     ////
11
////      - Howard M. Harte (hharte@opencores.org)                ////
12
////                                                              ////
13
//////////////////////////////////////////////////////////////////////
14
////                                                              ////
15
//// Copyright (C) 2008 Howard M. Harte                           ////
16
////                                                              ////
17
//// This source file may be used and distributed without         ////
18
//// restriction provided that this copyright statement is not    ////
19
//// removed from the file and that any derivative work contains  ////
20
//// the original copyright notice and the associated disclaimer. ////
21
////                                                              ////
22
//// This source file is free software; you can redistribute it   ////
23
//// and/or modify it under the terms of the GNU Lesser General   ////
24
//// Public License as published by the Free Software Foundation; ////
25
//// either version 2.1 of the License, or (at your option) any   ////
26
//// later version.                                               ////
27
////                                                              ////
28
//// This source is distributed in the hope that it will be       ////
29
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
30
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
31
//// PURPOSE.  See the GNU Lesser General Public License for more ////
32
//// details.                                                     ////
33
////                                                              ////
34
//// You should have received a copy of the GNU Lesser General    ////
35
//// Public License along with this source; if not, download it   ////
36
//// from http://www.opencores.org/lgpl.shtml                     ////
37
////                                                              ////
38
//////////////////////////////////////////////////////////////////////
39
 
40
`timescale 1 ns / 1 ns
41
 
42
`include "../../rtl/verilog/wb_lpc_defines.v"
43
 
44
module wb_dreq_host(clk_i, nrst_i,
45
                     dma_chan_o, dma_req_o,
46
                                                        ldrq_i
47
);
48
        // Wishbone Slave Interface
49
        input                   clk_i;
50
        input           nrst_i;                         // Active low reset.
51
 
52
        // Private DMA Interface
53
        output reg  [2:0] dma_chan_o;
54
        output reg                      dma_req_o;
55
 
56
        // LPC Bus DMA Request Input
57
        input                   ldrq_i;
58
 
59
        reg [1:0]        adr_cnt;
60
        reg [3:0]        state;
61
 
62
        always @(posedge clk_i or negedge nrst_i)
63
                if(~nrst_i)
64
                begin
65
                        state <= `LDRQ_ST_IDLE;
66
                        dma_chan_o <= 3'h0;
67
                        dma_req_o <= 3'h0;
68
                        adr_cnt <= 2'b00;
69
                end
70
                else begin
71
                        case(state)
72
                                `LDRQ_ST_IDLE:
73
                                        begin
74
                                                dma_req_o <= 1'b0;
75
                                                if(~ldrq_i) begin
76
                                                        state <= `LDRQ_ST_ADDR;
77
                                                        adr_cnt <= 2'h2;
78
                                                end
79
                                        end
80
                                `LDRQ_ST_ADDR:
81
                                        begin
82
                                                dma_chan_o[adr_cnt] <= ldrq_i;
83
                                                adr_cnt <= adr_cnt - 1;
84
 
85
                                                if(adr_cnt == 2'h0)
86
                                                        state <= `LDRQ_ST_ACT;
87
                                        end
88
                                `LDRQ_ST_ACT:
89
                                        begin
90
                                                dma_req_o <= ldrq_i;
91
                                                state <= `LDRQ_ST_DONE;
92
                                        end
93
                                `LDRQ_ST_DONE:
94
                                        begin
95
                                                dma_req_o <= 1'b0;
96
                                                state <= `LDRQ_ST_IDLE;
97
                                        end
98
                        endcase
99
                end
100
 
101
endmodule
102
 
103
 

powered by: WebSVN 2.1.0

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