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

Subversion Repositories wb_lpc

[/] [wb_lpc/] [trunk/] [rtl/] [verilog/] [wb_lpc_host.v] - Diff between revs 15 and 17

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 15 Rev 17
Line 1... Line 1...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
////                                                              ////
////                                                              ////
////  $Id: wb_lpc_host.v,v 1.3 2008-07-22 13:46:42 hharte Exp $   ////
////  $Id: wb_lpc_host.v,v 1.4 2008-07-26 19:15:31 hharte Exp $   ////
////  wb_lpc_host.v - Wishbone Slave to LPC Host Bridge           ////
////  wb_lpc_host.v - Wishbone Slave to LPC Host Bridge           ////
////                                                              ////
////                                                              ////
////  This file is part of the Wishbone LPC Bridge project        ////
////  This file is part of the Wishbone LPC Bridge project        ////
////  http://www.opencores.org/projects/wb_lpc/                   ////
////  http://www.opencores.org/projects/wb_lpc/                   ////
////                                                              ////
////                                                              ////
Line 50... Line 50...
//              5. H TAR  (2)       P SYNC (1+)   | H TAR  (2)    +-P SYNC (1+)
//              5. H TAR  (2)       P SYNC (1+)   | H TAR  (2)    +-P SYNC (1+)
//              6. P SYNC (1+)      P DATA (2)    | H SYNC (1+)   +-P DATA (2)
//              6. P SYNC (1+)      P DATA (2)    | H SYNC (1+)   +-P DATA (2)
//              7. P TAR  (2)       P TAR  (2)    +-P TAR  (2)      P TAR
//              7. P TAR  (2)       P TAR  (2)    +-P TAR  (2)      P TAR
//                                                          
//                                                          
module wb_lpc_host(clk_i, nrst_i, wbs_adr_i, wbs_dat_o, wbs_dat_i, wbs_sel_i, wbs_tga_i, wbs_we_i,
module wb_lpc_host(clk_i, nrst_i, wbs_adr_i, wbs_dat_o, wbs_dat_i, wbs_sel_i, wbs_tga_i, wbs_we_i,
                   wbs_stb_i, wbs_cyc_i, wbs_ack_o,
                   wbs_stb_i, wbs_cyc_i, wbs_ack_o, wbs_err_o,
                   dma_chan_i, dma_tc_i,
                   dma_chan_i, dma_tc_i,
                   lframe_o, lad_i, lad_o, lad_oe
                   lframe_o, lad_i, lad_o, lad_oe
);
);
    // Wishbone Slave Interface
    // Wishbone Slave Interface
    input              clk_i;
    input              clk_i;
Line 66... Line 66...
    input       [1:0]  wbs_tga_i;
    input       [1:0]  wbs_tga_i;
    input              wbs_we_i;
    input              wbs_we_i;
    input              wbs_stb_i;
    input              wbs_stb_i;
    input              wbs_cyc_i;
    input              wbs_cyc_i;
    output reg         wbs_ack_o;
    output reg         wbs_ack_o;
 
    output reg         wbs_err_o;
 
 
    // LPC Master Interface
    // LPC Master Interface
    output reg        lframe_o;     // LPC Frame output (active high)
    output reg        lframe_o;     // LPC Frame output (active high)
    output reg        lad_oe;       // LPC AD Output Enable
    output reg        lad_oe;       // LPC AD Output Enable
    input       [3:0] lad_i;        // LPC AD Input Bus
    input       [3:0] lad_i;        // LPC AD Input Bus
Line 77... Line 78...
 
 
    // DMA-Specific sideband signals
    // DMA-Specific sideband signals
    input       [2:0] dma_chan_i;   // DMA Channel
    input       [2:0] dma_chan_i;   // DMA Channel
    input             dma_tc_i;     // DMA Terminal Count
    input             dma_tc_i;     // DMA Terminal Count
 
 
    reg         [12:0] state;       // Current state
    reg         [13:0] state;       // Current state
    reg         [2:0] adr_cnt;      // Address nibbe counter
    reg         [2:0] adr_cnt;      // Address nibbe counter
    reg         [3:0] dat_cnt;      // Data nibble counter
    reg         [3:0] dat_cnt;      // Data nibble counter
    reg         [2:0] xfr_len;      // Number of nibbls for transfer
    reg         [2:0] xfr_len;      // Number of nibbls for transfer
    wire        [2:0] byte_cnt = dat_cnt[3:1];  // Byte Counter
    wire        [2:0] byte_cnt = dat_cnt[3:1];  // Byte Counter
    wire              nibble_cnt = dat_cnt[0];    // Nibble counter
    wire              nibble_cnt = dat_cnt[0];    // Nibble counter
Line 103... Line 104...
        if(~nrst_i)
        if(~nrst_i)
        begin
        begin
            state <= `LPC_ST_IDLE;
            state <= `LPC_ST_IDLE;
            lframe_o <= 1'b0;
            lframe_o <= 1'b0;
            wbs_ack_o <= 1'b0;
            wbs_ack_o <= 1'b0;
 
            wbs_err_o <= 1'b0;
            lad_oe <= 1'b0;
            lad_oe <= 1'b0;
            lad_o <= 4'b0;
            lad_o <= 4'b0;
            adr_cnt <= 3'b0;
            adr_cnt <= 3'b0;
            dat_cnt <= 4'h0;
            dat_cnt <= 4'h0;
            xfr_len <= 3'b000;
            xfr_len <= 3'b000;
Line 115... Line 117...
        else begin
        else begin
            case(state)
            case(state)
                `LPC_ST_IDLE:
                `LPC_ST_IDLE:
                    begin
                    begin
                        wbs_ack_o <= 1'b0;
                        wbs_ack_o <= 1'b0;
 
                        wbs_err_o <= 1'b0;
                        lframe_o <= 1'b0;
                        lframe_o <= 1'b0;
                        dat_cnt <= 4'h0;
                        dat_cnt <= 4'h0;
 
 
                        if(wbs_acc)     // Wishbone access starts LPC transaction
                        if(wbs_acc)     // Wishbone access starts LPC transaction
                            state <= `LPC_ST_START;
                            state <= `LPC_ST_START;
Line 292... Line 295...
                        state <= `LPC_ST_SYNC;
                        state <= `LPC_ST_SYNC;
                    end
                    end
                `LPC_ST_SYNC:
                `LPC_ST_SYNC:
                    begin
                    begin
                        lad_oe <= 1'b0;     // float LAD
                        lad_oe <= 1'b0;     // float LAD
                        if(lad_i == `LPC_SYNC_READY) begin
                        if((lad_i == `LPC_SYNC_READY) || (lad_i == `LPC_SYNC_MORE)) begin
                            if(wbs_wr) begin
                            if(wbs_wr) begin
                                state <= `LPC_ST_P_TAR1;
                                state <= `LPC_ST_P_TAR1;
                            end
                            end
                            else
                            else begin
                                state <= `LPC_ST_P_DATA;
                                state <= `LPC_ST_P_DATA;
                            end
                            end
                        else
                        end else if(lad_i == `LPC_SYNC_ERROR) begin
 
                            dat_cnt <= { xfr_len, 1'b1 };    // Terminate data transfer
 
                            wbs_err_o <= 1'b1;    // signal wishbone error
 
                            state <= `LPC_ST_P_TAR1;
 
                        end else begin
                            state <= `LPC_ST_SYNC;
                            state <= `LPC_ST_SYNC;
                    end
                    end
 
                    end
 
 
                `LPC_ST_P_DATA:
                `LPC_ST_P_DATA:
                    begin
                    begin
                        case(dat_cnt)
                        case(dat_cnt)
                            4'h0:
                            4'h0:
Line 357... Line 365...
                        end
                        end
                    end
                    end
                `LPC_ST_WB_RETIRE:
                `LPC_ST_WB_RETIRE:
                    begin
                    begin
                        wbs_ack_o <= 1'b0;
                        wbs_ack_o <= 1'b0;
 
                        wbs_err_o <= 1'b0;
                        if(wbs_acc) begin
                        if(wbs_acc) begin
                            state <= `LPC_ST_WB_RETIRE;
                            state <= `LPC_ST_WB_RETIRE;
                        end
                        end
                        else begin
                        else begin
                            state <= `LPC_ST_IDLE;
                            state <= `LPC_ST_IDLE;

powered by: WebSVN 2.1.0

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