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

Subversion Repositories oms8051mini

[/] [oms8051mini/] [trunk/] [rtl/] [8051/] [oc8051_ports.v] - Diff between revs 2 and 25

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 2 Rev 25
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
////                                                              ////
////                                                              ////
////  8051 port output                                            ////
////  8051 port output                                            ////
////                                                              ////
////                                                              ////
////  This file is part of the 8051 cores project                 ////
////  This file is part of the 8051 cores project                 ////
////  http://www.opencores.org/cores/oms8051mini/                 ////
////  http://www.opencores.org/cores/oms8051mini/                 ////
////                                                              ////
////                                                              ////
////  Description                                                 ////
////  Description                                                 ////
////   8051 special function registers: port 0:3 - output         ////
////   8051 special function registers: port 0:3 - output         ////
////                                                              ////
////                                                              ////
////  To Do:                                                      ////
////  To Do:                                                      ////
////   nothing                                                    ////
////   nothing                                                    ////
////                                                              ////
////                                                              ////
////  Author(s):                                                  ////
////  Author(s):                                                  ////
////      - Simon Teran, simont@opencores.org                     ////
////      - Simon Teran, simont@opencores.org                     ////
////      - Dinesh Annayya, simont@opencores.org                  ////
////      - Dinesh Annayya, simont@opencores.org                  ////
////                                                              ////
////                                                              ////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
 
////   v0.0 - Dinesh A, 5th Jan 2017
 
////        1. Active edge of reset changed from High to Low
 
//////////////////////////////////////////////////////////////////////
////                                                              ////
////                                                              ////
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
////                                                              ////
////                                                              ////
//// This source file may be used and distributed without         ////
//// This source file may be used and distributed without         ////
//// restriction provided that this copyright statement is not    ////
//// restriction provided that this copyright statement is not    ////
//// removed from the file and that any derivative work contains  ////
//// removed from the file and that any derivative work contains  ////
//// the original copyright notice and the associated disclaimer. ////
//// the original copyright notice and the associated disclaimer. ////
////                                                              ////
////                                                              ////
//// This source file is free software; you can redistribute it   ////
//// This source file is free software; you can redistribute it   ////
//// and/or modify it under the terms of the GNU Lesser General   ////
//// and/or modify it under the terms of the GNU Lesser General   ////
//// Public License as published by the Free Software Foundation; ////
//// Public License as published by the Free Software Foundation; ////
//// either version 2.1 of the License, or (at your option) any   ////
//// either version 2.1 of the License, or (at your option) any   ////
//// later version.                                               ////
//// later version.                                               ////
////                                                              ////
////                                                              ////
//// This source is distributed in the hope that it will be       ////
//// This source is distributed in the hope that it will be       ////
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
//// PURPOSE.  See the GNU Lesser General Public License for more ////
//// PURPOSE.  See the GNU Lesser General Public License for more ////
//// details.                                                     ////
//// details.                                                     ////
////                                                              ////
////                                                              ////
//// You should have received a copy of the GNU Lesser General    ////
//// You should have received a copy of the GNU Lesser General    ////
//// Public License along with this source; if not, download it   ////
//// Public License along with this source; if not, download it   ////
//// from http://www.opencores.org/lgpl.shtml                     ////
//// from http://www.opencores.org/lgpl.shtml                     ////
////                                                              ////
////                                                              ////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
// Revision 1.9  2003/04/10 12:43:19  simont
// Revision 1.9  2003/04/10 12:43:19  simont
// defines for pherypherals added
// defines for pherypherals added
//
//
// Revision 1.8  2003/04/07 14:58:02  simont
// Revision 1.8  2003/04/07 14:58:02  simont
// change sfr's interface.
// change sfr's interface.
//
//
// Revision 1.7  2003/01/13 14:14:41  simont
// Revision 1.7  2003/01/13 14:14:41  simont
// replace some modules
// replace some modules
//
//
// Revision 1.6  2002/09/30 17:33:59  simont
// Revision 1.6  2002/09/30 17:33:59  simont
// prepared header
// prepared header
//
//
//
//
 
 
 
 
`include "top_defines.v"
`include "top_defines.v"
 
 
 
 
module oc8051_ports (clk,
module oc8051_ports (clk,
                    rst,
                    resetn,
                    bit_in,
                    bit_in,
                    data_in,
                    data_in,
                    wr,
                    wr,
                    wr_bit,
                    wr_bit,
                    wr_addr,
                    wr_addr,
 
 
        `ifdef OC8051_PORT0
        `ifdef OC8051_PORT0
                    p0_out,
                    p0_out,
                    p0_in,
                    p0_in,
                    p0_data,
                    p0_data,
        `endif
        `endif
 
 
        `ifdef OC8051_PORT1
        `ifdef OC8051_PORT1
                    p1_out,
                    p1_out,
                    p1_in,
                    p1_in,
                    p1_data,
                    p1_data,
 
 
        `endif
        `endif
 
 
        `ifdef OC8051_PORT2
        `ifdef OC8051_PORT2
                    p2_out,
                    p2_out,
                    p2_in,
                    p2_in,
                    p2_data,
                    p2_data,
        `endif
        `endif
 
 
        `ifdef OC8051_PORT3
        `ifdef OC8051_PORT3
                    p3_out,
                    p3_out,
                    p3_in,
                    p3_in,
                    p3_data,
                    p3_data,
        `endif
        `endif
 
 
                    rmw);
                    rmw);
 
 
input        clk,       //clock
input        clk,       //clock
             rst,       //reset
             resetn,    //reset
             wr,        //write [oc8051_decoder.wr -r]
             wr,        //write [oc8051_decoder.wr -r]
             wr_bit,    //write bit addresable [oc8051_decoder.bit_addr -r]
             wr_bit,    //write bit addresable [oc8051_decoder.bit_addr -r]
             bit_in,    //bit input [oc8051_alu.desCy]
             bit_in,    //bit input [oc8051_alu.desCy]
             rmw;       //read modify write feature [oc8051_decoder.rmw]
             rmw;       //read modify write feature [oc8051_decoder.rmw]
input [7:0]  wr_addr,    //write address [oc8051_ram_wr_sel.out]
input [7:0]  wr_addr,    //write address [oc8051_ram_wr_sel.out]
             data_in;   //data input (from alu destiantion 1) [oc8051_alu.des1]
             data_in;   //data input (from alu destiantion 1) [oc8051_alu.des1]
 
 
`ifdef OC8051_PORT0
`ifdef OC8051_PORT0
  input  [7:0] p0_in;
  input  [7:0] p0_in;
  output [7:0] p0_out,
  output [7:0] p0_out,
               p0_data;
               p0_data;
  reg    [7:0] p0_out;
  reg    [7:0] p0_out;
 
 
  assign p0_data = rmw ? p0_out : p0_in;
  assign p0_data = rmw ? p0_out : p0_in;
`endif
`endif
 
 
 
 
`ifdef OC8051_PORT1
`ifdef OC8051_PORT1
  input  [7:0] p1_in;
  input  [7:0] p1_in;
  output [7:0] p1_out,
  output [7:0] p1_out,
               p1_data;
               p1_data;
  reg    [7:0] p1_out;
  reg    [7:0] p1_out;
 
 
  assign p1_data = rmw ? p1_out : p1_in;
  assign p1_data = rmw ? p1_out : p1_in;
`endif
`endif
 
 
 
 
`ifdef OC8051_PORT2
`ifdef OC8051_PORT2
  input  [7:0] p2_in;
  input  [7:0] p2_in;
  output [7:0] p2_out,
  output [7:0] p2_out,
               p2_data;
               p2_data;
  reg    [7:0] p2_out;
  reg    [7:0] p2_out;
 
 
  assign p2_data = rmw ? p2_out : p2_in;
  assign p2_data = rmw ? p2_out : p2_in;
`endif
`endif
 
 
 
 
`ifdef OC8051_PORT3
`ifdef OC8051_PORT3
  input  [7:0] p3_in;
  input  [7:0] p3_in;
  output [7:0] p3_out,
  output [7:0] p3_out,
               p3_data;
               p3_data;
  reg    [7:0] p3_out;
  reg    [7:0] p3_out;
 
 
  assign p3_data = rmw ? p3_out : p3_in;
  assign p3_data = rmw ? p3_out : p3_in;
`endif
`endif
 
 
//
//
// case of writing to port
// case of writing to port
always @(posedge clk or posedge rst)
always @(posedge clk or negedge resetn)
begin
begin
  if (rst) begin
  if (resetn == 1'b0) begin
`ifdef OC8051_PORT0
`ifdef OC8051_PORT0
    p0_out <= #1 `OC8051_RST_P0;
    p0_out <= #1 `OC8051_RST_P0;
`endif
`endif
 
 
`ifdef OC8051_PORT1
`ifdef OC8051_PORT1
    p1_out <= #1 `OC8051_RST_P1;
    p1_out <= #1 `OC8051_RST_P1;
`endif
`endif
 
 
`ifdef OC8051_PORT2
`ifdef OC8051_PORT2
    p2_out <= #1 `OC8051_RST_P2;
    p2_out <= #1 `OC8051_RST_P2;
`endif
`endif
 
 
`ifdef OC8051_PORT3
`ifdef OC8051_PORT3
    p3_out <= #1 `OC8051_RST_P3;
    p3_out <= #1 `OC8051_RST_P3;
`endif
`endif
  end else if (wr) begin
  end else if (wr) begin
    if (!wr_bit) begin
    if (!wr_bit) begin
      case (wr_addr) /* synopsys full_case parallel_case */
      case (wr_addr) /* synopsys full_case parallel_case */
//
//
// bytaddresable
// bytaddresable
`ifdef OC8051_PORT0
`ifdef OC8051_PORT0
        `OC8051_SFR_P0: begin p0_out <= #1 data_in;
        `OC8051_SFR_P0: begin p0_out <= #1 data_in;
         end
         end
`endif
`endif
 
 
`ifdef OC8051_PORT1
`ifdef OC8051_PORT1
        `OC8051_SFR_P1: p1_out <= #1 data_in;
        `OC8051_SFR_P1: p1_out <= #1 data_in;
`endif
`endif
 
 
`ifdef OC8051_PORT2
`ifdef OC8051_PORT2
        `OC8051_SFR_P2: p2_out <= #1 data_in;
        `OC8051_SFR_P2: p2_out <= #1 data_in;
`endif
`endif
 
 
`ifdef OC8051_PORT3
`ifdef OC8051_PORT3
        `OC8051_SFR_P3: p3_out <= #1 data_in;
        `OC8051_SFR_P3: p3_out <= #1 data_in;
`endif
`endif
      endcase
      endcase
    end else begin
    end else begin
      case (wr_addr[7:3]) /* synopsys full_case parallel_case */
      case (wr_addr[7:3]) /* synopsys full_case parallel_case */
 
 
//
//
// bit addressable
// bit addressable
`ifdef OC8051_PORT0
`ifdef OC8051_PORT0
        `OC8051_SFR_B_P0: p0_out[wr_addr[2:0]] <= #1 bit_in;
        `OC8051_SFR_B_P0: p0_out[wr_addr[2:0]] <= #1 bit_in;
`endif
`endif
 
 
`ifdef OC8051_PORT1
`ifdef OC8051_PORT1
        `OC8051_SFR_B_P1: p1_out[wr_addr[2:0]] <= #1 bit_in;
        `OC8051_SFR_B_P1: p1_out[wr_addr[2:0]] <= #1 bit_in;
`endif
`endif
 
 
`ifdef OC8051_PORT2
`ifdef OC8051_PORT2
        `OC8051_SFR_B_P2: p2_out[wr_addr[2:0]] <= #1 bit_in;
        `OC8051_SFR_B_P2: p2_out[wr_addr[2:0]] <= #1 bit_in;
`endif
`endif
 
 
`ifdef OC8051_PORT3
`ifdef OC8051_PORT3
        `OC8051_SFR_B_P3: p3_out[wr_addr[2:0]] <= #1 bit_in;
        `OC8051_SFR_B_P3: p3_out[wr_addr[2:0]] <= #1 bit_in;
`endif
`endif
      endcase
      endcase
    end
    end
  end
  end
end
end
 
 
 
 
endmodule
endmodule
 
 
 
 

powered by: WebSVN 2.1.0

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