⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 example.v

📁 Free 8051 core upload
💻 V
字号:
//**************************************************************************//
// Copyright (c) 1999-2005 Digital Core Design  DCD                         //
//**************************************************************************//
// Please review the terms of the license agreement before using this file. //
// If you are not an authorized user, please destroy this source code file  //
// and   notify   DCD  immediately  that  you  inadvertently  received  an  //
// unauthorized copy.                                                       //
//**************************************************************************//
//////////////////////////////////////////////////////////////////////////////
// Project name         : DP8051                                            //
// Project description  : DP8051 Microcontroller Unit                       //
//                                                                          //
// File name            : example.v                                         //
//                                                                          //
// Purpose              : DP8051 basic configuration with:                  //
//                        - 256B of on-chip Internal Data Memory            //
//                        - 4kB of on-chip ROM code Memory                  //
//                                                                          //
// Design Engineer      : P.K.                                              //
// Version              : 4.00                                              //
// Last modification    : 2005-03-03                                        //
//////////////////////////////////////////////////////////////////////////////

`timescale 1 ns / 1 ns // timescale for following modules

module example (clk, reset, int0, int1, xaddress, xdata, xdatawr, xdatard);

  ////////////////////////////////////////////////////////////////////////////
  // Global control wires inputs
  ////////////////////////////////////////////////////////////////////////////
  input clk;            // Global clock input
  input reset;          // Hardware reset input

  ////////////////////////////////////////////////////////////////////////////
  // Interupts inputs
  ////////////////////////////////////////////////////////////////////////////
  input int0;
  input int1;

  ////////////////////////////////////////////////////////////////////////////
  // External Data Memory interface
  ////////////////////////////////////////////////////////////////////////////
  output [9:0]xaddress;
  inout  [7:0]xdata;
  output xdatawr;       // External Data Memory write
  output xdatard;       // External Data Memory read


//**************************************************************************//

  ////////////////////////////////////////////////////////////////////////////
  // on-chip CODE configuration
  ////////////////////////////////////////////////////////////////////////////
  wire [7:0]prgromdatai_s;
  wire [9:0]prgaddr_s;
  
  ////////////////////////////////////////////////////////////////////////////
  // Internal Data Memory interface wires
  ////////////////////////////////////////////////////////////////////////////
  wire [5:0]ramaddr_s;
  wire [7:0]ramdatao_s;
  wire [7:0]ramdatai_s;
  wire ramwe_s;  // Data write enable
  
  ////////////////////////////////////////////////////////////////////////////
  // off-chip XDATA/XCODE wires
  ////////////////////////////////////////////////////////////////////////////
  wire [7:0]xdatao_s;
  wire xdataz_s;


  ////////////////////////////////////////////////////////////////////////////
  // DP8051 core
  ////////////////////////////////////////////////////////////////////////////
  DP8051 U_DP8051
    (
      ////////////////////////////////////////////////////////////////////////
      // Global control signals inputs
      ////////////////////////////////////////////////////////////////////////
      .clk              (clk),
      .reset            (reset),
      ////////////////////////////////////////////////////////////////////////
      // Program memory data input
      ////////////////////////////////////////////////////////////////////////
      .prgromdatai      (prgromdatai_s),
      ////////////////////////////////////////////////////////////////////////
      // External memory data input
      ////////////////////////////////////////////////////////////////////////
      .xdatai           (xdata),
      ////////////////////////////////////////////////////////////////////////
      // Internal RAM data input
      ////////////////////////////////////////////////////////////////////////
      .ramdatai         (ramdatai_s),
      ////////////////////////////////////////////////////////////////////////
      // Interupts inputs
      ////////////////////////////////////////////////////////////////////////
      .int0             (int0),
      .int1             (int1),
      ////////////////////////////////////////////////////////////////////////
      // Program Memory address
      ////////////////////////////////////////////////////////////////////////
      .prgaddr          (prgaddr_s),
      ////////////////////////////////////////////////////////////////////////
      // External Data Memory interface
      ////////////////////////////////////////////////////////////////////////
      .xaddress         (xaddress),
      .xdatao           (xdatao_s),
      .xdataz           (xdataz_s),
      .xdatawr          (xdatawr),
      .xdatard          (xdatard),
      ////////////////////////////////////////////////////////////////////////
      // Source and Destination address for RAM and SFR's
      ////////////////////////////////////////////////////////////////////////
      .ramaddr          (ramaddr_s),
      ////////////////////////////////////////////////////////////////////////
      // Data output for RAM and SFR's
      ////////////////////////////////////////////////////////////////////////
      .ramdatao         (ramdatao_s),
      ////////////////////////////////////////////////////////////////////////
      // RAM control signals
      ////////////////////////////////////////////////////////////////////////
      .ramwe            (ramwe_s)
     );

  ////////////////////////////////////////////////////////////////////////////
  // Internal Data Memory mappings
  ////////////////////////////////////////////////////////////////////////////
  idm U_IDM
  (
    .clk            (clk), 
    .we             (ramwe_s), 
    .addr           (ramaddr_s),
    .din            (ramdatao_s),
    .dout           (ramdatai_s)
  );

  ////////////////////////////////////////////////////////////////////////////
  // ROM Code Memory mappings
  ////////////////////////////////////////////////////////////////////////////
  rom U_ROM
  (
    .clk            (clk),
    .addr           (prgaddr_s[9:0]),
    .dout           (prgromdatai_s)
  );


  ////////////////////////////////////////////////////////////////////////////
  //xdata_drv:  // XRAM driver
  ////////////////////////////////////////////////////////////////////////////
  assign xdata = (xdataz_s==1'b1) ? xdatao_s : {8{1'bz}};

endmodule

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -