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

Subversion Repositories pci

[/] [pci/] [tags/] [rel_3/] [rtl/] [verilog/] [wb_slave.v] - Diff between revs 21 and 50

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

Rev 21 Rev 50
Line 40... Line 40...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.3  2002/02/01 15:25:13  mihad
 
// Repaired a few bugs, updated specification, added test bench files and design document
 
//
// Revision 1.2  2001/10/05 08:14:30  mihad
// Revision 1.2  2001/10/05 08:14:30  mihad
// Updated all files with inclusion of timescale file for simulation purposes.
// Updated all files with inclusion of timescale file for simulation purposes.
//
//
// Revision 1.1.1.1  2001/10/02 15:33:47  mihad
// Revision 1.1.1.1  2001/10/02 15:33:47  mihad
// New project directory structure
// New project directory structure
Line 542... Line 545...
// wire for write attempt - 1 when external WB master is attempting a write
// wire for write attempt - 1 when external WB master is attempting a write
// wire for read attempt  - 1 when external master is attempting a read
// wire for read attempt  - 1 when external master is attempting a read
wire wattempt = ( CYC_I && STB_I && WE_I ) && (!ACK_O && !ERR_O && !RTY_O) ;
wire wattempt = ( CYC_I && STB_I && WE_I ) && (!ACK_O && !ERR_O && !RTY_O) ;
wire rattempt = ( CYC_I && STB_I && ~WE_I ) && (!ACK_O && !ERR_O && !RTY_O) ;
wire rattempt = ( CYC_I && STB_I && ~WE_I ) && (!ACK_O && !ERR_O && !RTY_O) ;
 
 
`ifdef WB_DECODE_FAST
 
    `undef WB_DECODE_FAST
 
    `define WB_DECODE_MEDIUM
 
`endif
 
 
 
`else
`else
// wire for write attempt - 1 when external WB master is attempting a write
// wire for write attempt - 1 when external WB master is attempting a write
// wire for read attempt  - 1 when external master is attempting a read
// wire for read attempt  - 1 when external master is attempting a read
wire wattempt = ( CYC_I && STB_I && WE_I ) ; // write is qualified when cycle, strobe and write enable inputs are all high
wire wattempt = ( CYC_I && STB_I && WE_I ) ; // write is qualified when cycle, strobe and write enable inputs are all high
wire rattempt = ( CYC_I && STB_I && ~WE_I ) ; // read is qualified when cycle and strobe are high and write enable is low
wire rattempt = ( CYC_I && STB_I && ~WE_I ) ; // read is qualified when cycle and strobe are high and write enable is low
Line 610... Line 608...
    parameter SEL_ADDR_IN = 1'b1 ;
    parameter SEL_ADDR_IN = 1'b1 ;
    parameter SEL_DATA_IN = 1'b0 ;
    parameter SEL_DATA_IN = 1'b0 ;
`endif
`endif
`endif
`endif
 
 
 
`ifdef WB_DECODE_FAST
 
    `ifdef REGISTER_WBS_OUTPUTS
 
        `define PCI_WB_SLAVE_S_DEC1
 
    `endif
 
`endif
 
 
 
`ifdef WB_DECODE_MEDIUM
 
    `define PCI_WB_SLAVE_S_DEC1
 
`endif
 
 
 
`ifdef WB_DECODE_SLOW
 
    `define PCI_WB_SLAVE_S_DEC1
 
    `define PCI_WB_SLAVE_S_DEC2
 
`endif
// state machine logic
// state machine logic
always@(
always@(
        c_state                     or
        c_state                     or
        wattempt                    or
        wattempt                    or
        img_wallow                  or
        img_wallow                  or
Line 675... Line 687...
 
 
    case (c_state)
    case (c_state)
    S_IDLE: begin
    S_IDLE: begin
                if ( wattempt || rattempt )
                if ( wattempt || rattempt )
                begin
                begin
                    `ifdef WB_DECODE_FAST
 
 
                `ifdef PCI_WB_SLAVE_S_DEC1
 
                    n_state = S_DEC1 ;
 
                `else
                    decode_en = 1'b1 ;
                    decode_en = 1'b1 ;
                    n_state = S_START ;
                    n_state = S_START ;
                    `else
 
                    n_state = S_DEC1 ;
 
                    `endif
                    `endif
 
 
                    sample_address_out = 1'b1 ;
                    sample_address_out = 1'b1 ;
                end
                end
                else
                else
                    n_state = S_IDLE ;
                    n_state = S_IDLE ;
            end
            end
 
`ifdef PCI_WB_SLAVE_S_DEC1
    S_DEC1: begin
    S_DEC1: begin
                if ( wattempt || rattempt )
                if ( wattempt || rattempt )
                begin
                begin
                    `ifdef WB_DECODE_MEDIUM
 
 
                `ifdef PCI_WB_SLAVE_S_DEC2
 
                    n_state = S_DEC2 ;
 
                `else
                    decode_en = 1'b1 ;
                    decode_en = 1'b1 ;
                    n_state = S_START ;
                    n_state = S_START ;
                    `else
 
                    n_state = S_DEC2 ;
 
                    `endif
                    `endif
 
 
                end
                end
                else
                else
                    n_state = S_IDLE ;
                    n_state = S_IDLE ;
            end
            end
 
`endif
 
`ifdef PCI_WB_SLAVE_S_DEC2
    S_DEC2: begin
    S_DEC2: begin
 
 
                if ( wattempt || rattempt )
                if ( wattempt || rattempt )
                begin
                begin
                    decode_en = 1'b1 ;
                    decode_en = 1'b1 ;
                    n_state = S_START ;
                    n_state = S_START ;
                end
                end
                else
                else
                    n_state = S_IDLE ;
                    n_state = S_IDLE ;
            end
            end
 
`endif
    S_START:begin
    S_START:begin
                if (wb_conf_hit) // configuration space hit
                if (wb_conf_hit) // configuration space hit
                begin
                begin
                    `ifdef HOST
                    `ifdef HOST
                        wbw_data_out_sel = SEL_CCYC_ADDR ;
                        wbw_data_out_sel = SEL_CCYC_ADDR ;
Line 994... Line 1011...
`endif
`endif
 
 
`ifdef GUEST
`ifdef GUEST
    `ifdef NO_CNF_IMAGE
    `ifdef NO_CNF_IMAGE
    `else
    `else
        `define DO_OUT_MUX
        `define PCI_WB_SLAVE_DO_OUT_MUX
    `endif
    `endif
`else
`else
`ifdef HOST
`ifdef HOST
    `define DO_OUT_MUX ;
    `define PCI_WB_SLAVE_DO_OUT_MUX ;
`endif
`endif
`endif
`endif
 
 
`ifdef DO_OUT_MUX
`ifdef PCI_WB_SLAVE_DO_OUT_MUX
    reg [31:0] sdata_source ;
    reg [31:0] sdata_source ;
 
 
    // WISHBONE data output select lines for output multiplexor
    // WISHBONE data output select lines for output multiplexor
    wire sdata_o_sel_new = ( wb_conf_hit_in && ~wiack_hit && ~wccyc_hit ) ? CONF_SEL : WBR_SEL ;
    wire sdata_o_sel_new = ( wb_conf_hit_in && ~wiack_hit && ~wccyc_hit ) ? CONF_SEL : WBR_SEL ;
    reg sdata_o_sel ;
    reg sdata_o_sel ;
Line 1025... Line 1042...
        case (sdata_o_sel)
        case (sdata_o_sel)
            WBR_SEL :sdata_source = wbr_fifo_data_in ;
            WBR_SEL :sdata_source = wbr_fifo_data_in ;
            CONF_SEL:sdata_source = wb_conf_data_in ;
            CONF_SEL:sdata_source = wb_conf_data_in ;
        endcase
        endcase
    end
    end
    `undef DO_OUT_MUX
 
`else
`else
    wire [31:0] sdata_source = wbr_fifo_data_in ;
    wire [31:0] sdata_source = wbr_fifo_data_in ;
`endif
`endif
 
 
`ifdef REGISTER_WBS_OUTPUTS
`ifdef REGISTER_WBS_OUTPUTS

powered by: WebSVN 2.1.0

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