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

Subversion Repositories wb_mcs51

[/] [wb_mcs51/] [trunk/] [rtl/] [verilog/] [wb_mcs51.v] - Diff between revs 2 and 3

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

Rev 2 Rev 3
Line 1... Line 1...
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
////                                                             ////
////                                                             ////
//// MCS51 to Wishbone Interface                                 ////
//// MCS51 to Wishbone Interface                                 ////
////                                                             ////
////                                                             ////
//// $Id: wb_mcs51.v,v 1.1 2008-03-03 15:54:43 hharte Exp $          ////
//// $Id: wb_mcs51.v,v 1.2 2008-03-10 13:58:10 hharte Exp $          ////
////                                                             ////
////                                                             ////
//// Copyright (C) 2007 Howard M. Harte                          ////
//// Copyright (C) 2007 Howard M. Harte                          ////
////                    hharte@opencores.org                     ////
////                    hharte@opencores.org                     ////
////                                                             ////
////                                                             ////
//// This source file may be used and distributed without        ////
//// This source file may be used and distributed without        ////
Line 30... Line 30...
 
 
module wb_mcs51 (nrst_i, clk_i, mcs51_ale, mcs51_rd, mcs51_wr, mcs51_ad_inout,
module wb_mcs51 (nrst_i, clk_i, mcs51_ale, mcs51_rd, mcs51_wr, mcs51_ad_inout,
                 wbm_adr_o, wbm_dat_i, wbm_dat_o, wbm_sel_o, wbm_cyc_o,
                 wbm_adr_o, wbm_dat_i, wbm_dat_o, wbm_sel_o, wbm_cyc_o,
                 wbm_stb_o, wbm_we_o, wbm_ack_i, wbm_rty_i, wbm_err_i);
                 wbm_stb_o, wbm_we_o, wbm_ack_i, wbm_rty_i, wbm_err_i);
 
 
 
   parameter mcs51_aw = 8 ;
 
    parameter wb_aw = 16;
 
 
   input nrst_i;
   input nrst_i;
   input clk_i;
   input clk_i;
   input mcs51_ale;
   input mcs51_ale;
   input mcs51_rd;
   input mcs51_rd;
   input mcs51_wr;
   input mcs51_wr;
   inout [7:0] mcs51_ad_inout;
   inout [mcs51_aw-1:0] mcs51_ad_inout;
 
 
   // Wishbone master interface
   // WISHBONE master interface
   output [15:0]  wbm_adr_o;
   output [wb_aw-1:0]  wbm_adr_o;
   input  [7:0]   wbm_dat_i;
   input  [7:0]   wbm_dat_i;
   output [7:0]   wbm_dat_o;
   output [7:0]   wbm_dat_o;
   output         wbm_sel_o;
   output         wbm_sel_o;
   output         wbm_cyc_o;
   output         wbm_cyc_o;
   output         wbm_stb_o;
   output         wbm_stb_o;
Line 52... Line 55...
   input          wbm_err_i;
   input          wbm_err_i;
 
 
   wire  l_wbm_stb;
   wire  l_wbm_stb;
   wire  mcs51_ad_oe;
   wire  mcs51_ad_oe;
 
 
   reg   [15:0]   mcs51_addr;
   reg   [mcs51_aw-1:0]   mcs51_addr;
 
 
   always @(negedge mcs51_ale or negedge nrst_i)
   always @(negedge mcs51_ale or negedge nrst_i)
      if (~nrst_i)
      if (~nrst_i)
         begin
         begin
            mcs51_addr <= 16'h0000;
            mcs51_addr <= {{wb_aw}{1'b0}};
         end
         end
      else if(~mcs51_ale)     // Latch address
      else if(~mcs51_ale)     // Latch address
         mcs51_addr <= { 8'h0 , mcs51_ad_inout };
         mcs51_addr <= { {{16-mcs51_aw}{1'b0}} , mcs51_ad_inout[mcs51_aw-1:0] };
 
 
   assign mcs51_ad_oe = ~mcs51_rd;
   assign mcs51_ad_oe = ~mcs51_rd;
 
 
   assign wbm_adr_o = mcs51_addr;
   assign wbm_adr_o = { {{wb_aw-16}{1'b0}}, mcs51_addr };
   assign wbm_we_o = ~mcs51_wr;
   assign wbm_we_o = ~mcs51_wr;
   assign wbm_stb_o = ~mcs51_wr | ~mcs51_rd;
   assign wbm_stb_o = ~mcs51_wr | ~mcs51_rd;
   assign wbm_cyc_o = wbm_stb_o;
   assign wbm_cyc_o = wbm_stb_o;
   assign mcs51_ad_inout = mcs51_ad_oe ? wbm_dat_i : 8'bzzzzzzzz;
   assign mcs51_ad_inout = mcs51_ad_oe ? wbm_dat_i : 8'bzzzzzzzz;
   assign wbm_sel_o = wbm_stb_o;
   assign wbm_sel_o = wbm_stb_o;
 
 
   assign wbm_dat_o = mcs51_ad_inout;
   assign wbm_dat_o = mcs51_ad_inout[7:0];
 
 
 
    assign wmb_sel_o = 4'b0001;
 
 
endmodule
endmodule
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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