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

Subversion Repositories wb2axip

[/] [wb2axip/] [trunk/] [rtl/] [aximwr2wbsp.v] - Diff between revs 8 and 16

Show entire file | Details | Blame | View Log

Rev 8 Rev 16
Line 1... Line 1...
 
`error This full featured AXI to WB converter does not (yet) work
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//
//
// Filename:    aximwr2wbsp.v
// Filename:    aximwr2wbsp.v
//
//
// Project:     Pipelined Wishbone to AXI converter
// Project:     Pipelined Wishbone to AXI converter
Line 7... Line 8...
// Purpose:     Convert the three AXI4 write channels to a single wishbone
// Purpose:     Convert the three AXI4 write channels to a single wishbone
//              channel to write the results.
//              channel to write the results.
//
//
//      Still need to implement the lock feature.
//      Still need to implement the lock feature.
//
//
 
        // We're going to need to keep track of transaction bursts in progress,
 
        // since the wishbone doesn't.  For this, we'll use a FIFO, but with
 
        // multiple pointers:
 
        //
 
        //      fifo_ahead      - pointer to where to write the next incoming
 
        //                              bus request .. adjusted when
 
        //                              (o_axi_awready)&&(i_axi_awvalid)
 
        //      fifo_neck       - pointer to where to read from the FIFO in
 
        //                              order to issue another request.  Used
 
        //                              when (o_wb_stb)&&(!i_wb_stall)
 
        //      fifo_torso      - pointer to where to write a wishbone
 
        //                              transaction upon return.
 
        //                              when (i_ack)
 
        //      fifo_tail       - pointer to where the last transaction is to
 
        //                              be retired when
 
        //                                      (i_axi_rvalid)&&(i_axi_rready)
 
        //
 
        // All of these are to be set to zero upon a reset signal.
 
        //
 
//
// Creator:     Dan Gisselquist, Ph.D.
// Creator:     Dan Gisselquist, Ph.D.
//              Gisselquist Technology, LLC
//              Gisselquist Technology, LLC
//
//
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//
//
// Copyright (C) 2015-2016, Gisselquist Technology, LLC
// Copyright (C) 2015-2019, Gisselquist Technology, LLC
//
//
// This program is free software (firmware): you can redistribute it and/or
// This file is part of the pipelined Wishbone to AXI converter project, a
// modify it under the terms of  the GNU General Public License as published
// project that contains multiple bus bridging designs and formal bus property
// by the Free Software Foundation, either version 3 of the License, or (at
// sets.
// your option) any later version.
//
//
// The bus bridge designs and property sets are free RTL designs: you can
// This program is distributed in the hope that it will be useful, but WITHOUT
// redistribute them and/or modify any of them under the terms of the GNU
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
// Lesser General Public License as published by the Free Software Foundation,
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
// either version 3 of the License, or (at your option) any later version.
// for more details.
//
//
// The bus bridge designs and property sets are distributed in the hope that
// You should have received a copy of the GNU General Public License along
// they will be useful, but WITHOUT ANY WARRANTY; without even the implied
// with this program.  (It's in the $(ROOT)/doc directory, run make with no
// warranty of MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// target there if the PDF file isn't present.)  If not, see
// GNU Lesser General Public License for more details.
 
//
 
// You should have received a copy of the GNU Lesser General Public License
 
// along with these designs.  (It's in the $(ROOT)/doc directory.  Run make
 
// with no target there if the PDF file isn't present.)  If not, see
// <http://www.gnu.org/licenses/> for a copy.
// <http://www.gnu.org/licenses/> for a copy.
//
//
// License:     GPL, v3, as defined and found on www.gnu.org,
// License:     LGPL, v3, as defined and found on www.gnu.org,
//              http://www.gnu.org/licenses/gpl.html
//              http://www.gnu.org/licenses/lgpl.html
//
 
//
//
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
`default_nettype        none
`default_nettype        none
Line 86... Line 110...
        output  wire [(C_AXI_DATA_WIDTH/8-1):0]  o_wb_sel,
        output  wire [(C_AXI_DATA_WIDTH/8-1):0]  o_wb_sel,
        input   wire                    i_wb_ack,
        input   wire                    i_wb_ack,
        input   wire                    i_wb_stall,
        input   wire                    i_wb_stall,
        // input        [(C_AXI_DATA_WIDTH-1):0]        i_wb_data,
        // input        [(C_AXI_DATA_WIDTH-1):0]        i_wb_data,
        input   wire                    i_wb_err
        input   wire                    i_wb_err
 
`ifdef  FORMAL
 
        ,
 
        output  wire    [LGFIFO-1:0]     f_fifo_ahead,
 
        output  wire    [LGFIFO-1:0]     f_fifo_dhead,
 
        output  wire    [LGFIFO-1:0]     f_fifo_neck,
 
        output  wire    [LGFIFO-1:0]     f_fifo_torso,
 
        output  wire    [LGFIFO-1:0]     f_fifo_tail
 
`endif
);
);
 
 
        localparam      DW = C_AXI_DATA_WIDTH;
        localparam      DW = C_AXI_DATA_WIDTH;
 
 
        wire    w_reset;
        wire    w_reset;
Line 119... Line 151...
        reg     filling_fifo, incr;
        reg     filling_fifo, incr;
        reg     [7:0]    len;
        reg     [7:0]    len;
        reg     [(AW-1):0]       wr_fifo_addr;
        reg     [(AW-1):0]       wr_fifo_addr;
        reg     [(C_AXI_ID_WIDTH-1):0]   wr_fifo_id;
        reg     [(C_AXI_ID_WIDTH-1):0]   wr_fifo_id;
 
 
        wire    axi_aw_req, axi_wr_req;
        wire    axi_aw_req, axi_wr_req, axi_wr_ack;
        assign  axi_aw_req = (o_axi_awready)&&(i_axi_awvalid);
        assign  axi_aw_req = (o_axi_awready)&&(i_axi_awvalid);
        assign  axi_wr_req = (o_axi_wready)&&(i_axi_wvalid);
        assign  axi_wr_req = (o_axi_wready)&&(i_axi_wvalid);
 
        assign  axi_wr_ack = (o_axi_bvalid)&&(i_axi_bready);
 
 
        wire    fifo_full;
        wire    fifo_full;
        assign  fifo_full = (next_ahead == fifo_tail)||(next_dhead ==fifo_tail);
        assign  fifo_full = (next_ahead == fifo_tail)||(next_dhead ==fifo_tail);
 
 
        initial fifo_ahead = 0;
        initial fifo_ahead = 0;
Line 197... Line 230...
                        err_state <= 0;
                        err_state <= 0;
                end else if (o_wb_stb)
                end else if (o_wb_stb)
                begin
                begin
                        if (i_wb_err)
                        if (i_wb_err)
                        begin
                        begin
 
                                o_wb_cyc <= 1'b0;
                                o_wb_stb <= 1'b0;
                                o_wb_stb <= 1'b0;
                                err_state <= 1'b0;
                                err_state <= 1'b1;
                        end
                        end else if (!i_wb_stall)
                        else if (!i_wb_stall)
 
                                o_wb_stb <= (fifo_ahead != next_neck)
                                o_wb_stb <= (fifo_ahead != next_neck)
                                        &&(fifo_dhead != next_neck);
                                        &&(fifo_dhead != next_neck);
 
 
                        if ((!i_wb_stall)&&(fifo_neck != fifo_ahead)&&(fifo_neck != fifo_dhead))
                        if ((!i_wb_stall)&&(fifo_neck != fifo_ahead)&&(fifo_neck != fifo_dhead))
                                fifo_neck <= next_neck;
                                fifo_neck <= next_neck;
Line 212... Line 245...
                        if (i_wb_ack)
                        if (i_wb_ack)
                                fifo_torso <= next_torso;
                                fifo_torso <= next_torso;
 
 
                        if (fifo_neck == next_torso)
                        if (fifo_neck == next_torso)
                                o_wb_cyc <= 1'b0;
                                o_wb_cyc <= 1'b0;
                end else if (err_state)
                end else if ((err_state)||(i_wb_err))
                begin
                begin
                        o_wb_cyc <= 1'b0;
                        o_wb_cyc <= 1'b0;
                        if (fifo_torso != fifo_neck)
                        o_wb_stb <= 1'b0;
 
                        err_state <= (err_state)||(i_wb_err);
 
                        if ((o_wb_cyc)&&(fifo_torso != fifo_neck))
                                fifo_torso <= next_torso;
                                fifo_torso <= next_torso;
                        if (fifo_neck == next_torso)
                        if (fifo_neck == next_torso)
                                err_state <= 1'b0;
                                err_state <= 1'b0;
                end else if (o_wb_cyc)
                end else if (o_wb_cyc)
                begin
                begin
                        if (i_wb_ack)
                        if (i_wb_ack)
                                fifo_torso <= next_torso;
                                fifo_torso <= next_torso;
                        if (fifo_neck == next_torso)
                        if (fifo_neck == next_torso)
                                o_wb_cyc <= 1'b0;
                                o_wb_cyc <= 1'b0;
                end else if((fifo_ahead!= fifo_neck)&&(fifo_dhead != fifo_neck))
                end else if((fifo_ahead!= fifo_neck)
 
                                &&(fifo_dhead != fifo_neck))
                begin
                begin
                        o_wb_cyc <= 1;
                        o_wb_cyc <= 1;
                        o_wb_stb <= 1;
                        o_wb_stb <= 1;
                end
                end
        end
        end
Line 252... Line 288...
 
 
        initial fifo_tail = 0;
        initial fifo_tail = 0;
        always @(posedge i_axi_clk)
        always @(posedge i_axi_clk)
                if (w_reset)
                if (w_reset)
                        fifo_tail <= 0;
                        fifo_tail <= 0;
                else if ((o_axi_bvalid)&&(i_axi_bready))
                else if (axi_wr_ack)
                        fifo_tail <= next_tail;
                        fifo_tail <= next_tail;
 
 
        always @(posedge i_axi_clk)
        always @(posedge i_axi_clk)
                afifo_at_tail <= afifo[fifo_tail];
                afifo_at_tail <= afifo[fifo_tail];
        always @(posedge i_axi_clk)
        always @(posedge i_axi_clk)
Line 308... Line 344...
                assert(f_fifo_torso_used <= f_dfifo_used);
                assert(f_fifo_torso_used <= f_dfifo_used);
        always @(*)
        always @(*)
                assert((!o_wb_stb)||
                assert((!o_wb_stb)||
                        ((fifo_neck != fifo_ahead)
                        ((fifo_neck != fifo_ahead)
                                &&(fifo_neck != fifo_dhead)));
                                &&(fifo_neck != fifo_dhead)));
 
 
 
        assign  f_fifo_ahead = fifo_ahead;
 
        assign  f_fifo_dhead = fifo_dhead;
 
        assign  f_fifo_neck  = fifo_neck;
 
        assign  f_fifo_torso = fifo_torso;
 
        assign  f_fifo_tail  = fifo_tail;
 
 
 
        always @(*)
 
                if (i_axi_awvalid)
 
                        assert(!i_axi_awburst[1]);
`endif
`endif
endmodule
endmodule
 
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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