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

Subversion Repositories xge_mac

[/] [xge_mac/] [trunk/] [rtl/] [verilog/] [wishbone_if.v] - Diff between revs 24 and 27

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

Rev 24 Rev 27
Line 38... Line 38...
 
 
`include "defines.v"
`include "defines.v"
 
 
module wishbone_if(/*AUTOARG*/
module wishbone_if(/*AUTOARG*/
  // Outputs
  // Outputs
  wb_dat_o, wb_ack_o, wb_int_o, ctrl_tx_enable,
  wb_dat_o, wb_ack_o, wb_int_o, ctrl_tx_enable, clear_stats_tx_octets,
 
  clear_stats_tx_pkts, clear_stats_rx_octets, clear_stats_rx_pkts,
  // Inputs
  // Inputs
  wb_clk_i, wb_rst_i, wb_adr_i, wb_dat_i, wb_we_i, wb_stb_i, wb_cyc_i,
  wb_clk_i, wb_rst_i, wb_adr_i, wb_dat_i, wb_we_i, wb_stb_i, wb_cyc_i,
  status_crc_error, status_fragment_error, status_txdfifo_ovflow,
  status_crc_error, status_fragment_error, status_txdfifo_ovflow,
  status_txdfifo_udflow, status_rxdfifo_ovflow, status_rxdfifo_udflow,
  status_txdfifo_udflow, status_rxdfifo_ovflow, status_rxdfifo_udflow,
  status_pause_frame_rx, status_local_fault, status_remote_fault,
  status_pause_frame_rx, status_local_fault, status_remote_fault,
Line 85... Line 86...
input  [31:0] stats_rx_octets;
input  [31:0] stats_rx_octets;
input  [31:0] stats_rx_pkts;
input  [31:0] stats_rx_pkts;
 
 
output        ctrl_tx_enable;
output        ctrl_tx_enable;
 
 
 
output        clear_stats_tx_octets;
 
output        clear_stats_tx_pkts;
 
output        clear_stats_rx_octets;
 
output        clear_stats_rx_pkts;
 
 
/*AUTOREG*/
/*AUTOREG*/
// Beginning of automatic regs (for this module's undeclared outputs)
// Beginning of automatic regs (for this module's undeclared outputs)
 
reg                     clear_stats_rx_octets;
 
reg                     clear_stats_rx_pkts;
 
reg                     clear_stats_tx_octets;
 
reg                     clear_stats_tx_pkts;
reg [31:0]              wb_dat_o;
reg [31:0]              wb_dat_o;
reg                     wb_int_o;
reg                     wb_int_o;
// End of automatics
// End of automatics
 
 
 
reg [31:0]              next_wb_dat_o;
 
reg                     next_wb_int_o;
 
 
reg  [0:0]              cpureg_config0;
reg  [0:0]              cpureg_config0;
 
reg  [0:0]              next_cpureg_config0;
 
 
reg  [8:0]              cpureg_int_pending;
reg  [8:0]              cpureg_int_pending;
 
reg  [8:0]              next_cpureg_int_pending;
 
 
reg  [8:0]              cpureg_int_mask;
reg  [8:0]              cpureg_int_mask;
 
reg  [8:0]              next_cpureg_int_mask;
 
 
reg                     cpuack;
reg                     cpuack;
 
reg                     next_cpuack;
 
 
reg                     status_remote_fault_d1;
reg                     status_remote_fault_d1;
reg                     status_local_fault_d1;
reg                     status_local_fault_d1;
 
 
 
 
/*AUTOWIRE*/
/*AUTOWIRE*/
 
 
wire [8:0]             int_sources;
wire [8:0]             int_sources;
 
 
 
 
Line 131... Line 148...
//---
//---
// Config Register 0
// Config Register 0
 
 
assign ctrl_tx_enable = cpureg_config0[0];
assign ctrl_tx_enable = cpureg_config0[0];
 
 
 
 
 
 
//---
//---
// Wishbone signals
// Wishbone signals
 
 
assign wb_ack_o = cpuack && wb_stb_i;
assign wb_ack_o = cpuack && wb_stb_i;
 
 
always @(posedge wb_clk_i or posedge wb_rst_i) begin
always @(/*AS*/cpureg_config0 or cpureg_int_mask or cpureg_int_pending
 
         or int_sources or stats_rx_octets or stats_rx_pkts
    if (wb_rst_i == 1'b1) begin
         or stats_tx_octets or stats_tx_pkts or wb_adr_i or wb_cyc_i
 
         or wb_dat_i or wb_dat_o or wb_stb_i or wb_we_i) begin
        cpureg_config0 <= 1'h1;
 
        cpureg_int_pending <= 9'b0;
 
        cpureg_int_mask <= 9'b0;
 
 
 
        wb_dat_o <= 32'b0;
    next_wb_dat_o = wb_dat_o;
        wb_int_o <= 1'b0;
 
 
 
        cpuack <= 1'b0;
    next_wb_int_o = |(cpureg_int_pending & cpureg_int_mask);
 
 
        status_remote_fault_d1 <= 1'b0;
    next_cpureg_int_pending = cpureg_int_pending | int_sources;
        status_local_fault_d1 <= 1'b0;
 
 
 
    end
    next_cpuack = wb_cyc_i && wb_stb_i;
    else begin
 
 
 
        wb_int_o <= |(cpureg_int_pending & cpureg_int_mask);
    //---
 
    // Registers
 
 
        cpureg_int_pending <= cpureg_int_pending | int_sources;
    next_cpureg_config0 = cpureg_config0;
 
    next_cpureg_int_mask = cpureg_int_mask;
 
 
        cpuack <= wb_cyc_i && wb_stb_i;
    //---
 
    // Clear on read signals
 
 
        status_remote_fault_d1 <= status_remote_fault;
    clear_stats_tx_octets = 1'b0;
        status_local_fault_d1 <= status_local_fault;
    clear_stats_tx_pkts = 1'b0;
 
    clear_stats_rx_octets = 1'b0;
 
    clear_stats_rx_pkts = 1'b0;
 
 
        //---
        //---
        // Read access
        // Read access
 
 
        if (wb_cyc_i && wb_stb_i && !wb_we_i) begin
        if (wb_cyc_i && wb_stb_i && !wb_we_i) begin
 
 
            case ({wb_adr_i[7:2], 2'b0})
            case ({wb_adr_i[7:2], 2'b0})
 
 
              `CPUREG_CONFIG0: begin
              `CPUREG_CONFIG0: begin
                  wb_dat_o <= {31'b0, cpureg_config0};
              next_wb_dat_o = {31'b0, cpureg_config0};
              end
              end
 
 
              `CPUREG_INT_PENDING: begin
              `CPUREG_INT_PENDING: begin
                  wb_dat_o <= {23'b0, cpureg_int_pending};
              next_wb_dat_o = {23'b0, cpureg_int_pending};
                  cpureg_int_pending <= int_sources;
              next_cpureg_int_pending = int_sources;
                  wb_int_o <= 1'b0;
              next_wb_int_o = 1'b0;
              end
              end
 
 
              `CPUREG_INT_STATUS: begin
              `CPUREG_INT_STATUS: begin
                  wb_dat_o <= {23'b0, int_sources};
              next_wb_dat_o = {23'b0, int_sources};
              end
              end
 
 
              `CPUREG_INT_MASK: begin
              `CPUREG_INT_MASK: begin
                  wb_dat_o <= {23'b0, cpureg_int_mask};
              next_wb_dat_o = {23'b0, cpureg_int_mask};
              end
              end
 
 
              `CPUREG_STATSTXOCTETS: begin
              `CPUREG_STATSTXOCTETS: begin
                  wb_dat_o <= stats_tx_octets;
              next_wb_dat_o = stats_tx_octets;
 
              clear_stats_tx_octets = 1'b1;
              end
              end
 
 
              `CPUREG_STATSTXPKTS: begin
              `CPUREG_STATSTXPKTS: begin
                  wb_dat_o <= stats_tx_pkts;
              next_wb_dat_o = stats_tx_pkts;
 
              clear_stats_tx_pkts = 1'b1;
              end
              end
 
 
              `CPUREG_STATSRXOCTETS: begin
              `CPUREG_STATSRXOCTETS: begin
                  wb_dat_o <= stats_rx_octets;
              next_wb_dat_o = stats_rx_octets;
 
              clear_stats_rx_octets = 1'b1;
              end
              end
 
 
              `CPUREG_STATSRXPKTS: begin
              `CPUREG_STATSRXPKTS: begin
                  wb_dat_o <= stats_rx_pkts;
              next_wb_dat_o = stats_rx_pkts;
 
              clear_stats_rx_pkts = 1'b1;
              end
              end
 
 
              default: begin
              default: begin
              end
              end
 
 
Line 222... Line 240...
        if (wb_cyc_i && wb_stb_i && wb_we_i) begin
        if (wb_cyc_i && wb_stb_i && wb_we_i) begin
 
 
            case ({wb_adr_i[7:2], 2'b0})
            case ({wb_adr_i[7:2], 2'b0})
 
 
              `CPUREG_CONFIG0: begin
              `CPUREG_CONFIG0: begin
                  cpureg_config0 <= wb_dat_i[0:0];
              next_cpureg_config0 = wb_dat_i[0:0];
              end
              end
 
 
              `CPUREG_INT_PENDING: begin
              `CPUREG_INT_PENDING: begin
                  cpureg_int_pending <= wb_dat_i[8:0] | cpureg_int_pending | int_sources;
              next_cpureg_int_pending = wb_dat_i[8:0] | cpureg_int_pending | int_sources;
              end
              end
 
 
              `CPUREG_INT_MASK: begin
              `CPUREG_INT_MASK: begin
                  cpureg_int_mask <= wb_dat_i[8:0];
              next_cpureg_int_mask = wb_dat_i[8:0];
              end
              end
 
 
              default: begin
              default: begin
              end
              end
 
 
Line 242... Line 260...
 
 
        end
        end
 
 
    end
    end
 
 
 
always @(posedge wb_clk_i or posedge wb_rst_i) begin
 
 
 
    if (wb_rst_i == 1'b1) begin
 
 
 
        cpureg_config0 <= 1'h1;
 
        cpureg_int_pending <= 9'b0;
 
        cpureg_int_mask <= 9'b0;
 
 
 
        wb_dat_o <= 32'b0;
 
        wb_int_o <= 1'b0;
 
 
 
        cpuack <= 1'b0;
 
 
 
        status_remote_fault_d1 <= 1'b0;
 
        status_local_fault_d1 <= 1'b0;
 
 
 
    end
 
    else begin
 
 
 
        cpureg_config0 <= next_cpureg_config0;
 
        cpureg_int_pending <= next_cpureg_int_pending;
 
        cpureg_int_mask <= next_cpureg_int_mask;
 
 
 
        wb_dat_o <= next_wb_dat_o;
 
        wb_int_o <= next_wb_int_o;
 
 
 
        cpuack <= next_cpuack;
 
 
 
        status_remote_fault_d1 <= status_remote_fault;
 
        status_local_fault_d1 <= status_local_fault;
 
 
 
    end
 
 
end
end
 
 
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.