//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
// Copyright (C) 2009 , Olivier Girard
|
// Copyright (C) 2009 , Olivier Girard
|
//
|
//
|
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
// modification, are permitted provided that the following conditions
|
// modification, are permitted provided that the following conditions
|
// are met:
|
// are met:
|
// * Redistributions of source code must retain the above copyright
|
// * Redistributions of source code must retain the above copyright
|
// notice, this list of conditions and the following disclaimer.
|
// notice, this list of conditions and the following disclaimer.
|
// * Redistributions in binary form must reproduce the above copyright
|
// * Redistributions in binary form must reproduce the above copyright
|
// notice, this list of conditions and the following disclaimer in the
|
// notice, this list of conditions and the following disclaimer in the
|
// documentation and/or other materials provided with the distribution.
|
// documentation and/or other materials provided with the distribution.
|
// * Neither the name of the authors nor the names of its contributors
|
// * Neither the name of the authors nor the names of its contributors
|
// may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
// without specific prior written permission.
|
// without specific prior written permission.
|
//
|
//
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
// THE POSSIBILITY OF SUCH DAMAGE
|
// THE POSSIBILITY OF SUCH DAMAGE
|
//
|
//
|
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
//
|
//
|
// *File Name: openMSP430_defines.v
|
// *File Name: openMSP430_defines.v
|
//
|
//
|
// *Module Description:
|
// *Module Description:
|
// openMSP430 Configuration file
|
// openMSP430 Configuration file
|
//
|
//
|
// *Author(s):
|
// *Author(s):
|
// - Olivier Girard, olgirard@gmail.com
|
// - Olivier Girard, olgirard@gmail.com
|
//
|
//
|
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
// $Rev: 151 $
|
// $Rev: 155 $
|
// $LastChangedBy: olivier.girard $
|
// $LastChangedBy: olivier.girard $
|
// $LastChangedDate: 2012-07-23 00:24:11 +0200 (Mon, 23 Jul 2012) $
|
// $LastChangedDate: 2012-10-15 23:35:05 +0200 (Mon, 15 Oct 2012) $
|
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
//`define OMSP_NO_INCLUDE
|
//`define OMSP_NO_INCLUDE
|
`ifdef OMSP_NO_INCLUDE
|
`ifdef OMSP_NO_INCLUDE
|
`else
|
`else
|
`include "openMSP430_undefines.v"
|
`include "openMSP430_undefines.v"
|
`endif
|
`endif
|
|
|
//============================================================================
|
//============================================================================
|
//============================================================================
|
//============================================================================
|
// BASIC SYSTEM CONFIGURATION
|
// BASIC SYSTEM CONFIGURATION
|
//============================================================================
|
//============================================================================
|
//============================================================================
|
//============================================================================
|
//
|
//
|
// Note: the sum of program, data and peripheral memory spaces must not
|
// Note: the sum of program, data and peripheral memory spaces must not
|
// exceed 64 kB
|
// exceed 64 kB
|
//
|
//
|
|
|
// Program Memory Size:
|
// Program Memory Size:
|
// Uncomment the required memory size
|
// Uncomment the required memory size
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
//`define PMEM_SIZE_CUSTOM
|
//`define PMEM_SIZE_CUSTOM
|
//`define PMEM_SIZE_59_KB
|
//`define PMEM_SIZE_59_KB
|
//`define PMEM_SIZE_55_KB
|
//`define PMEM_SIZE_55_KB
|
//`define PMEM_SIZE_54_KB
|
//`define PMEM_SIZE_54_KB
|
//`define PMEM_SIZE_51_KB
|
//`define PMEM_SIZE_51_KB
|
//`define PMEM_SIZE_48_KB
|
//`define PMEM_SIZE_48_KB
|
//`define PMEM_SIZE_41_KB
|
//`define PMEM_SIZE_41_KB
|
//`define PMEM_SIZE_32_KB
|
//`define PMEM_SIZE_32_KB
|
//`define PMEM_SIZE_24_KB
|
//`define PMEM_SIZE_24_KB
|
//`define PMEM_SIZE_16_KB
|
//`define PMEM_SIZE_16_KB
|
//`define PMEM_SIZE_12_KB
|
//`define PMEM_SIZE_12_KB
|
//`define PMEM_SIZE_8_KB
|
//`define PMEM_SIZE_8_KB
|
`define PMEM_SIZE_4_KB
|
`define PMEM_SIZE_4_KB
|
//`define PMEM_SIZE_2_KB
|
//`define PMEM_SIZE_2_KB
|
//`define PMEM_SIZE_1_KB
|
//`define PMEM_SIZE_1_KB
|
|
|
|
|
// Data Memory Size:
|
// Data Memory Size:
|
// Uncomment the required memory size
|
// Uncomment the required memory size
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
//`define DMEM_SIZE_CUSTOM
|
//`define DMEM_SIZE_CUSTOM
|
//`define DMEM_SIZE_32_KB
|
//`define DMEM_SIZE_32_KB
|
//`define DMEM_SIZE_24_KB
|
//`define DMEM_SIZE_24_KB
|
//`define DMEM_SIZE_16_KB
|
//`define DMEM_SIZE_16_KB
|
//`define DMEM_SIZE_10_KB
|
//`define DMEM_SIZE_10_KB
|
//`define DMEM_SIZE_8_KB
|
//`define DMEM_SIZE_8_KB
|
//`define DMEM_SIZE_5_KB
|
//`define DMEM_SIZE_5_KB
|
//`define DMEM_SIZE_4_KB
|
//`define DMEM_SIZE_4_KB
|
//`define DMEM_SIZE_2p5_KB
|
//`define DMEM_SIZE_2p5_KB
|
//`define DMEM_SIZE_2_KB
|
//`define DMEM_SIZE_2_KB
|
`define DMEM_SIZE_1_KB
|
`define DMEM_SIZE_1_KB
|
//`define DMEM_SIZE_512_B
|
//`define DMEM_SIZE_512_B
|
//`define DMEM_SIZE_256_B
|
//`define DMEM_SIZE_256_B
|
//`define DMEM_SIZE_128_B
|
//`define DMEM_SIZE_128_B
|
|
|
|
|
// Include/Exclude Hardware Multiplier
|
// Include/Exclude Hardware Multiplier
|
`define MULTIPLIER
|
`define MULTIPLIER
|
|
|
|
|
// Include/Exclude Serial Debug interface
|
// Include/Exclude Serial Debug interface
|
`define DBG_EN
|
`define DBG_EN
|
|
|
|
|
//============================================================================
|
//============================================================================
|
//============================================================================
|
//============================================================================
|
// ADVANCED SYSTEM CONFIGURATION (FOR EXPERIENCED USERS)
|
// ADVANCED SYSTEM CONFIGURATION (FOR EXPERIENCED USERS)
|
//============================================================================
|
//============================================================================
|
//============================================================================
|
//============================================================================
|
|
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// Custom user version number
|
// Custom user version number
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// This 5 bit field can be freely used in order to allow
|
// This 5 bit field can be freely used in order to allow
|
// custom identification of the system through the debug
|
// custom identification of the system through the debug
|
// interface.
|
// interface.
|
// (see CPU_ID.USER_VERSION field in the documentation)
|
// (see CPU_ID.USER_VERSION field in the documentation)
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
`define USER_VERSION 5'b00001
|
`define USER_VERSION 5'b00001
|
|
|
|
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// Include/Exclude Watchdog timer
|
// Include/Exclude Watchdog timer
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// When excluded, the following functionality will be
|
// When excluded, the following functionality will be
|
// lost:
|
// lost:
|
// - Watchog (both interval and watchdog modes)
|
// - Watchog (both interval and watchdog modes)
|
// - NMI interrupt edge selection
|
// - NMI interrupt edge selection
|
// - Possibility to generate a software PUC reset
|
// - Possibility to generate a software PUC reset
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
`define WATCHDOG
|
`define WATCHDOG
|
|
|
|
|
///-------------------------------------------------------
|
///-------------------------------------------------------
|
// Include/Exclude Non-Maskable-Interrupt support
|
// Include/Exclude Non-Maskable-Interrupt support
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
`define NMI
|
`define NMI
|
|
|
|
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// Input synchronizers
|
// Input synchronizers
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// In some cases, the asynchronous input ports might
|
// In some cases, the asynchronous input ports might
|
// already be synchronized externally.
|
// already be synchronized externally.
|
// If an extensive CDC design review showed that this
|
// If an extensive CDC design review showed that this
|
// is really the case, the individual synchronizers
|
// is really the case, the individual synchronizers
|
// can be disabled with the following defines.
|
// can be disabled with the following defines.
|
//
|
//
|
// Notes:
|
// Notes:
|
// - all three signals are all sampled in the MCLK domain
|
// - all three signals are all sampled in the MCLK domain
|
//
|
//
|
// - the dbg_en signal reset the debug interface
|
// - the dbg_en signal reset the debug interface
|
// when 0. Therefore make sure it is glitch free.
|
// when 0. Therefore make sure it is glitch free.
|
//
|
//
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
`define SYNC_NMI
|
`define SYNC_NMI
|
`define SYNC_CPU_EN
|
`define SYNC_CPU_EN
|
`define SYNC_DBG_EN
|
`define SYNC_DBG_EN
|
|
|
|
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// Peripheral Memory Space:
|
// Peripheral Memory Space:
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// The original MSP430 architecture map the peripherals
|
// The original MSP430 architecture map the peripherals
|
// from 0x0000 to 0x01FF (i.e. 512B of the memory space).
|
// from 0x0000 to 0x01FF (i.e. 512B of the memory space).
|
// The following defines allow you to expand this space
|
// The following defines allow you to expand this space
|
// up to 32 kB (i.e. from 0x0000 to 0x7fff).
|
// up to 32 kB (i.e. from 0x0000 to 0x7fff).
|
// As a consequence, the data memory mapping will be
|
// As a consequence, the data memory mapping will be
|
// shifted up and a custom linker script will therefore
|
// shifted up and a custom linker script will therefore
|
// be required by the GCC compiler.
|
// be required by the GCC compiler.
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
//`define PER_SIZE_CUSTOM
|
//`define PER_SIZE_CUSTOM
|
//`define PER_SIZE_32_KB
|
//`define PER_SIZE_32_KB
|
//`define PER_SIZE_16_KB
|
//`define PER_SIZE_16_KB
|
//`define PER_SIZE_8_KB
|
//`define PER_SIZE_8_KB
|
//`define PER_SIZE_4_KB
|
//`define PER_SIZE_4_KB
|
//`define PER_SIZE_2_KB
|
//`define PER_SIZE_2_KB
|
//`define PER_SIZE_1_KB
|
//`define PER_SIZE_1_KB
|
`define PER_SIZE_512_B
|
`define PER_SIZE_512_B
|
|
|
|
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// Defines the debugger CPU_CTL.RST_BRK_EN reset value
|
// Defines the debugger CPU_CTL.RST_BRK_EN reset value
|
// (CPU break on PUC reset)
|
// (CPU break on PUC reset)
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// When defined, the CPU will automatically break after
|
// When defined, the CPU will automatically break after
|
// a PUC occurrence by default. This is typically useful
|
// a PUC occurrence by default. This is typically useful
|
// when the program memory can only be initialized through
|
// when the program memory can only be initialized through
|
// the serial debug interface.
|
// the serial debug interface.
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
//`define DBG_RST_BRK_EN
|
//`define DBG_RST_BRK_EN
|
|
|
|
|
//============================================================================
|
//============================================================================
|
//============================================================================
|
//============================================================================
|
// EXPERT SYSTEM CONFIGURATION ( !!!! EXPERTS ONLY !!!! )
|
// EXPERT SYSTEM CONFIGURATION ( !!!! EXPERTS ONLY !!!! )
|
//============================================================================
|
//============================================================================
|
//============================================================================
|
//============================================================================
|
//
|
//
|
// IMPORTANT NOTE: Please update following configuration options ONLY if
|
// IMPORTANT NOTE: Please update following configuration options ONLY if
|
// you have a good reason to do so... and if you know what
|
// you have a good reason to do so... and if you know what
|
// you are doing :-P
|
// you are doing :-P
|
//
|
//
|
//============================================================================
|
//============================================================================
|
|
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
|
// Select serial debug interface protocol
|
|
//-------------------------------------------------------
|
|
// DBG_UART -> Enable UART (8N1) debug interface
|
|
// DBG_I2C -> Enable I2C debug interface
|
|
//-------------------------------------------------------
|
|
`define DBG_UART
|
|
//`define DBG_I2C
|
|
|
|
|
|
//-------------------------------------------------------
|
|
// Enable the I2C broadcast address
|
|
//-------------------------------------------------------
|
|
// For multicore systems, a common I2C broadcast address
|
|
// can be given to all oMSP cores in order to
|
|
// synchronously RESET, START, STOP, or STEP all CPUs
|
|
// at once with a single I2C command.
|
|
// If you have a single openMSP430 in your system,
|
|
// this option can stay commented-out.
|
|
//-------------------------------------------------------
|
|
//`define DBG_I2C_BROADCAST
|
|
|
|
|
|
//-------------------------------------------------------
|
// Number of hardware breakpoint/watchpoint units
|
// Number of hardware breakpoint/watchpoint units
|
// (each unit contains two hardware addresses available
|
// (each unit contains two hardware addresses available
|
// for breakpoints or watchpoints):
|
// for breakpoints or watchpoints):
|
// - DBG_HWBRK_0 -> Include hardware breakpoints unit 0
|
// - DBG_HWBRK_0 -> Include hardware breakpoints unit 0
|
// - DBG_HWBRK_1 -> Include hardware breakpoints unit 1
|
// - DBG_HWBRK_1 -> Include hardware breakpoints unit 1
|
// - DBG_HWBRK_2 -> Include hardware breakpoints unit 2
|
// - DBG_HWBRK_2 -> Include hardware breakpoints unit 2
|
// - DBG_HWBRK_3 -> Include hardware breakpoints unit 3
|
// - DBG_HWBRK_3 -> Include hardware breakpoints unit 3
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// Please keep in mind that hardware breakpoints only
|
// Please keep in mind that hardware breakpoints only
|
// make sense whenever the program memory is not an SRAM
|
// make sense whenever the program memory is not an SRAM
|
// (i.e. Flash/OTP/ROM/...) or when you are interested
|
// (i.e. Flash/OTP/ROM/...) or when you are interested
|
// in data breakpoints.
|
// in data breakpoints.
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
`define DBG_HWBRK_0
|
`define DBG_HWBRK_0
|
//`define DBG_HWBRK_1
|
//`define DBG_HWBRK_1
|
//`define DBG_HWBRK_2
|
//`define DBG_HWBRK_2
|
//`define DBG_HWBRK_3
|
//`define DBG_HWBRK_3
|
|
|
|
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// Enable/Disable the hardware breakpoint RANGE mode
|
// Enable/Disable the hardware breakpoint RANGE mode
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// When enabled this feature allows the hardware breakpoint
|
// When enabled this feature allows the hardware breakpoint
|
// units to stop the cpu whenever an instruction or data
|
// units to stop the cpu whenever an instruction or data
|
// access lays within an address range.
|
// access lays within an address range.
|
// Note that this feature is not supported by GDB.
|
// Note that this feature is not supported by GDB.
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
//`define DBG_HWBRK_RANGE
|
//`define DBG_HWBRK_RANGE
|
|
|
|
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// Custom Program/Data and Peripheral Memory Spaces
|
// Custom Program/Data and Peripheral Memory Spaces
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// The following values are valid only if the
|
// The following values are valid only if the
|
// corresponding *_SIZE_CUSTOM defines are uncommented:
|
// corresponding *_SIZE_CUSTOM defines are uncommented:
|
//
|
//
|
// - *_SIZE : size of the section in bytes.
|
// - *_SIZE : size of the section in bytes.
|
// - *_AWIDTH : address port width, this value must allow
|
// - *_AWIDTH : address port width, this value must allow
|
// to address all WORDS of the section
|
// to address all WORDS of the section
|
// (i.e. the *_SIZE divided by 2)
|
// (i.e. the *_SIZE divided by 2)
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
|
|
// Custom Program memory (enabled with PMEM_SIZE_CUSTOM)
|
// Custom Program memory (enabled with PMEM_SIZE_CUSTOM)
|
`define PMEM_CUSTOM_AWIDTH 10
|
`define PMEM_CUSTOM_AWIDTH 10
|
`define PMEM_CUSTOM_SIZE 2048
|
`define PMEM_CUSTOM_SIZE 2048
|
|
|
// Custom Data memory (enabled with DMEM_SIZE_CUSTOM)
|
// Custom Data memory (enabled with DMEM_SIZE_CUSTOM)
|
`define DMEM_CUSTOM_AWIDTH 6
|
`define DMEM_CUSTOM_AWIDTH 6
|
`define DMEM_CUSTOM_SIZE 128
|
`define DMEM_CUSTOM_SIZE 128
|
|
|
// Custom Peripheral memory (enabled with PER_SIZE_CUSTOM)
|
// Custom Peripheral memory (enabled with PER_SIZE_CUSTOM)
|
`define PER_CUSTOM_AWIDTH 8
|
`define PER_CUSTOM_AWIDTH 8
|
`define PER_CUSTOM_SIZE 512
|
`define PER_CUSTOM_SIZE 512
|
|
|
|
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// ASIC version
|
// ASIC version
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// When uncommented, this define will enable the
|
// When uncommented, this define will enable the
|
// ASIC system configuration section (see below) and
|
// ASIC system configuration section (see below) and
|
// will activate scan support for production test.
|
// will activate scan support for production test.
|
//
|
//
|
// WARNING: if you target an FPGA, leave this define
|
// WARNING: if you target an FPGA, leave this define
|
// commented.
|
// commented.
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
//`define ASIC
|
//`define ASIC
|
|
|
|
|
//============================================================================
|
//============================================================================
|
//============================================================================
|
//============================================================================
|
// ASIC SYSTEM CONFIGURATION ( !!!! EXPERTS/PROFESSIONALS ONLY !!!! )
|
// ASIC SYSTEM CONFIGURATION ( !!!! EXPERTS/PROFESSIONALS ONLY !!!! )
|
//============================================================================
|
//============================================================================
|
//============================================================================
|
//============================================================================
|
`ifdef ASIC
|
`ifdef ASIC
|
|
|
//===============================================================
|
//===============================================================
|
// FINE GRAINED CLOCK GATING
|
// FINE GRAINED CLOCK GATING
|
//===============================================================
|
//===============================================================
|
|
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// When uncommented, this define will enable the fine
|
// When uncommented, this define will enable the fine
|
// grained clock gating of all registers in the core.
|
// grained clock gating of all registers in the core.
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
`define CLOCK_GATING
|
`define CLOCK_GATING
|
|
|
|
|
//===============================================================
|
//===============================================================
|
// LFXT CLOCK DOMAIN
|
// LFXT CLOCK DOMAIN
|
//===============================================================
|
//===============================================================
|
|
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// When uncommented, this define will enable the lfxt_clk
|
// When uncommented, this define will enable the lfxt_clk
|
// clock domain.
|
// clock domain.
|
// When commented out, the whole chip is clocked with dco_clk.
|
// When commented out, the whole chip is clocked with dco_clk.
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
`define LFXT_DOMAIN
|
`define LFXT_DOMAIN
|
|
|
|
|
//===============================================================
|
//===============================================================
|
// CLOCK MUXES
|
// CLOCK MUXES
|
//===============================================================
|
//===============================================================
|
|
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// MCLK: Clock Mux
|
// MCLK: Clock Mux
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// When uncommented, this define will enable the
|
// When uncommented, this define will enable the
|
// MCLK clock MUX allowing the selection between
|
// MCLK clock MUX allowing the selection between
|
// DCO_CLK and LFXT_CLK with the BCSCTL2.SELMx register.
|
// DCO_CLK and LFXT_CLK with the BCSCTL2.SELMx register.
|
// When commented, DCO_CLK is selected.
|
// When commented, DCO_CLK is selected.
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
`define MCLK_MUX
|
`define MCLK_MUX
|
|
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// SMCLK: Clock Mux
|
// SMCLK: Clock Mux
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// When uncommented, this define will enable the
|
// When uncommented, this define will enable the
|
// SMCLK clock MUX allowing the selection between
|
// SMCLK clock MUX allowing the selection between
|
// DCO_CLK and LFXT_CLK with the BCSCTL2.SELS register.
|
// DCO_CLK and LFXT_CLK with the BCSCTL2.SELS register.
|
// When commented, DCO_CLK is selected.
|
// When commented, DCO_CLK is selected.
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
`define SMCLK_MUX
|
`define SMCLK_MUX
|
|
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// WATCHDOG: Clock Mux
|
// WATCHDOG: Clock Mux
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// When uncommented, this define will enable the
|
// When uncommented, this define will enable the
|
// Watchdog clock MUX allowing the selection between
|
// Watchdog clock MUX allowing the selection between
|
// ACLK and SMCLK with the WDTCTL.WDTSSEL register.
|
// ACLK and SMCLK with the WDTCTL.WDTSSEL register.
|
// When commented out, ACLK is selected if the
|
// When commented out, ACLK is selected if the
|
// WATCHDOG_NOMUX_ACLK define is uncommented, SMCLK is
|
// WATCHDOG_NOMUX_ACLK define is uncommented, SMCLK is
|
// selected otherwise.
|
// selected otherwise.
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
`define WATCHDOG_MUX
|
`define WATCHDOG_MUX
|
//`define WATCHDOG_NOMUX_ACLK
|
//`define WATCHDOG_NOMUX_ACLK
|
|
|
|
|
//===============================================================
|
//===============================================================
|
// CLOCK DIVIDERS
|
// CLOCK DIVIDERS
|
//===============================================================
|
//===============================================================
|
|
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// MCLK: Clock divider
|
// MCLK: Clock divider
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// When uncommented, this define will enable the
|
// When uncommented, this define will enable the
|
// MCLK clock divider (/1/2/4/8)
|
// MCLK clock divider (/1/2/4/8)
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
`define MCLK_DIVIDER
|
`define MCLK_DIVIDER
|
|
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// SMCLK: Clock divider (/1/2/4/8)
|
// SMCLK: Clock divider (/1/2/4/8)
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// When uncommented, this define will enable the
|
// When uncommented, this define will enable the
|
// SMCLK clock divider
|
// SMCLK clock divider
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
`define SMCLK_DIVIDER
|
`define SMCLK_DIVIDER
|
|
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// ACLK: Clock divider (/1/2/4/8)
|
// ACLK: Clock divider (/1/2/4/8)
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// When uncommented, this define will enable the
|
// When uncommented, this define will enable the
|
// ACLK clock divider
|
// ACLK clock divider
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
`define ACLK_DIVIDER
|
`define ACLK_DIVIDER
|
|
|
|
|
//===============================================================
|
//===============================================================
|
// LOW POWER MODES
|
// LOW POWER MODES
|
//===============================================================
|
//===============================================================
|
|
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// LOW POWER MODE: CPUOFF
|
// LOW POWER MODE: CPUOFF
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// When uncommented, this define will include the
|
// When uncommented, this define will include the
|
// clock gate allowing to switch off MCLK in
|
// clock gate allowing to switch off MCLK in
|
// all low power modes: LPM0, LPM1, LPM2, LPM3, LPM4
|
// all low power modes: LPM0, LPM1, LPM2, LPM3, LPM4
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
`define CPUOFF_EN
|
`define CPUOFF_EN
|
|
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// LOW POWER MODE: SCG0
|
// LOW POWER MODE: SCG0
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// When uncommented, this define will enable the
|
// When uncommented, this define will enable the
|
// DCO_ENABLE/WKUP port control (always 1 when commented).
|
// DCO_ENABLE/WKUP port control (always 1 when commented).
|
// This allows to switch off the DCO oscillator in the
|
// This allows to switch off the DCO oscillator in the
|
// following low power modes: LPM1, LPM3, LPM4
|
// following low power modes: LPM1, LPM3, LPM4
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
`define SCG0_EN
|
`define SCG0_EN
|
|
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// LOW POWER MODE: SCG1
|
// LOW POWER MODE: SCG1
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// When uncommented, this define will include the
|
// When uncommented, this define will include the
|
// clock gate allowing to switch off SMCLK in
|
// clock gate allowing to switch off SMCLK in
|
// the following low power modes: LPM2, LPM3, LPM4
|
// the following low power modes: LPM2, LPM3, LPM4
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
`define SCG1_EN
|
`define SCG1_EN
|
|
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// LOW POWER MODE: OSCOFF
|
// LOW POWER MODE: OSCOFF
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
// When uncommented, this define will include the
|
// When uncommented, this define will include the
|
// LFXT_CLK clock gate and enable the LFXT_ENABLE/WKUP
|
// LFXT_CLK clock gate and enable the LFXT_ENABLE/WKUP
|
// port control (always 1 when commented).
|
// port control (always 1 when commented).
|
// This allows to switch off the low frequency oscillator
|
// This allows to switch off the low frequency oscillator
|
// in the following low power modes: LPM4
|
// in the following low power modes: LPM4
|
//-------------------------------------------------------
|
//-------------------------------------------------------
|
`define OSCOFF_EN
|
`define OSCOFF_EN
|
|
|
|
|
|
|
`endif
|
`endif
|
|
|
//==========================================================================//
|
//==========================================================================//
|
//==========================================================================//
|
//==========================================================================//
|
//==========================================================================//
|
//==========================================================================//
|
//==========================================================================//
|
//==========================================================================//
|
//===== SYSTEM CONSTANTS --- !!!!!!!! DO NOT EDIT !!!!!!!! =====//
|
//===== SYSTEM CONSTANTS --- !!!!!!!! DO NOT EDIT !!!!!!!! =====//
|
//==========================================================================//
|
//==========================================================================//
|
//==========================================================================//
|
//==========================================================================//
|
//==========================================================================//
|
//==========================================================================//
|
//==========================================================================//
|
//==========================================================================//
|
|
|
//
|
//
|
// PROGRAM, DATA & PERIPHERAL MEMORY CONFIGURATION
|
// PROGRAM, DATA & PERIPHERAL MEMORY CONFIGURATION
|
//==================================================
|
//==================================================
|
|
|
// Program Memory Size
|
// Program Memory Size
|
`ifdef PMEM_SIZE_59_KB
|
`ifdef PMEM_SIZE_59_KB
|
`define PMEM_AWIDTH 15
|
`define PMEM_AWIDTH 15
|
`define PMEM_SIZE 60416
|
`define PMEM_SIZE 60416
|
`endif
|
`endif
|
`ifdef PMEM_SIZE_55_KB
|
`ifdef PMEM_SIZE_55_KB
|
`define PMEM_AWIDTH 15
|
`define PMEM_AWIDTH 15
|
`define PMEM_SIZE 56320
|
`define PMEM_SIZE 56320
|
`endif
|
`endif
|
`ifdef PMEM_SIZE_54_KB
|
`ifdef PMEM_SIZE_54_KB
|
`define PMEM_AWIDTH 15
|
`define PMEM_AWIDTH 15
|
`define PMEM_SIZE 55296
|
`define PMEM_SIZE 55296
|
`endif
|
`endif
|
`ifdef PMEM_SIZE_51_KB
|
`ifdef PMEM_SIZE_51_KB
|
`define PMEM_AWIDTH 15
|
`define PMEM_AWIDTH 15
|
`define PMEM_SIZE 52224
|
`define PMEM_SIZE 52224
|
`endif
|
`endif
|
`ifdef PMEM_SIZE_48_KB
|
`ifdef PMEM_SIZE_48_KB
|
`define PMEM_AWIDTH 15
|
`define PMEM_AWIDTH 15
|
`define PMEM_SIZE 49152
|
`define PMEM_SIZE 49152
|
`endif
|
`endif
|
`ifdef PMEM_SIZE_41_KB
|
`ifdef PMEM_SIZE_41_KB
|
`define PMEM_AWIDTH 15
|
`define PMEM_AWIDTH 15
|
`define PMEM_SIZE 41984
|
`define PMEM_SIZE 41984
|
`endif
|
`endif
|
`ifdef PMEM_SIZE_32_KB
|
`ifdef PMEM_SIZE_32_KB
|
`define PMEM_AWIDTH 14
|
`define PMEM_AWIDTH 14
|
`define PMEM_SIZE 32768
|
`define PMEM_SIZE 32768
|
`endif
|
`endif
|
`ifdef PMEM_SIZE_24_KB
|
`ifdef PMEM_SIZE_24_KB
|
`define PMEM_AWIDTH 14
|
`define PMEM_AWIDTH 14
|
`define PMEM_SIZE 24576
|
`define PMEM_SIZE 24576
|
`endif
|
`endif
|
`ifdef PMEM_SIZE_16_KB
|
`ifdef PMEM_SIZE_16_KB
|
`define PMEM_AWIDTH 13
|
`define PMEM_AWIDTH 13
|
`define PMEM_SIZE 16384
|
`define PMEM_SIZE 16384
|
`endif
|
`endif
|
`ifdef PMEM_SIZE_12_KB
|
`ifdef PMEM_SIZE_12_KB
|
`define PMEM_AWIDTH 13
|
`define PMEM_AWIDTH 13
|
`define PMEM_SIZE 12288
|
`define PMEM_SIZE 12288
|
`endif
|
`endif
|
`ifdef PMEM_SIZE_8_KB
|
`ifdef PMEM_SIZE_8_KB
|
`define PMEM_AWIDTH 12
|
`define PMEM_AWIDTH 12
|
`define PMEM_SIZE 8192
|
`define PMEM_SIZE 8192
|
`endif
|
`endif
|
`ifdef PMEM_SIZE_4_KB
|
`ifdef PMEM_SIZE_4_KB
|
`define PMEM_AWIDTH 11
|
`define PMEM_AWIDTH 11
|
`define PMEM_SIZE 4096
|
`define PMEM_SIZE 4096
|
`endif
|
`endif
|
`ifdef PMEM_SIZE_2_KB
|
`ifdef PMEM_SIZE_2_KB
|
`define PMEM_AWIDTH 10
|
`define PMEM_AWIDTH 10
|
`define PMEM_SIZE 2048
|
`define PMEM_SIZE 2048
|
`endif
|
`endif
|
`ifdef PMEM_SIZE_1_KB
|
`ifdef PMEM_SIZE_1_KB
|
`define PMEM_AWIDTH 9
|
`define PMEM_AWIDTH 9
|
`define PMEM_SIZE 1024
|
`define PMEM_SIZE 1024
|
`endif
|
`endif
|
`ifdef PMEM_SIZE_CUSTOM
|
`ifdef PMEM_SIZE_CUSTOM
|
`define PMEM_AWIDTH `PMEM_CUSTOM_AWIDTH
|
`define PMEM_AWIDTH `PMEM_CUSTOM_AWIDTH
|
`define PMEM_SIZE `PMEM_CUSTOM_SIZE
|
`define PMEM_SIZE `PMEM_CUSTOM_SIZE
|
`endif
|
`endif
|
|
|
// Data Memory Size
|
// Data Memory Size
|
`ifdef DMEM_SIZE_32_KB
|
`ifdef DMEM_SIZE_32_KB
|
`define DMEM_AWIDTH 14
|
`define DMEM_AWIDTH 14
|
`define DMEM_SIZE 32768
|
`define DMEM_SIZE 32768
|
`endif
|
`endif
|
`ifdef DMEM_SIZE_24_KB
|
`ifdef DMEM_SIZE_24_KB
|
`define DMEM_AWIDTH 14
|
`define DMEM_AWIDTH 14
|
`define DMEM_SIZE 24576
|
`define DMEM_SIZE 24576
|
`endif
|
`endif
|
`ifdef DMEM_SIZE_16_KB
|
`ifdef DMEM_SIZE_16_KB
|
`define DMEM_AWIDTH 13
|
`define DMEM_AWIDTH 13
|
`define DMEM_SIZE 16384
|
`define DMEM_SIZE 16384
|
`endif
|
`endif
|
`ifdef DMEM_SIZE_10_KB
|
`ifdef DMEM_SIZE_10_KB
|
`define DMEM_AWIDTH 13
|
`define DMEM_AWIDTH 13
|
`define DMEM_SIZE 10240
|
`define DMEM_SIZE 10240
|
`endif
|
`endif
|
`ifdef DMEM_SIZE_8_KB
|
`ifdef DMEM_SIZE_8_KB
|
`define DMEM_AWIDTH 12
|
`define DMEM_AWIDTH 12
|
`define DMEM_SIZE 8192
|
`define DMEM_SIZE 8192
|
`endif
|
`endif
|
`ifdef DMEM_SIZE_5_KB
|
`ifdef DMEM_SIZE_5_KB
|
`define DMEM_AWIDTH 12
|
`define DMEM_AWIDTH 12
|
`define DMEM_SIZE 5120
|
`define DMEM_SIZE 5120
|
`endif
|
`endif
|
`ifdef DMEM_SIZE_4_KB
|
`ifdef DMEM_SIZE_4_KB
|
`define DMEM_AWIDTH 11
|
`define DMEM_AWIDTH 11
|
`define DMEM_SIZE 4096
|
`define DMEM_SIZE 4096
|
`endif
|
`endif
|
`ifdef DMEM_SIZE_2p5_KB
|
`ifdef DMEM_SIZE_2p5_KB
|
`define DMEM_AWIDTH 11
|
`define DMEM_AWIDTH 11
|
`define DMEM_SIZE 2560
|
`define DMEM_SIZE 2560
|
`endif
|
`endif
|
`ifdef DMEM_SIZE_2_KB
|
`ifdef DMEM_SIZE_2_KB
|
`define DMEM_AWIDTH 10
|
`define DMEM_AWIDTH 10
|
`define DMEM_SIZE 2048
|
`define DMEM_SIZE 2048
|
`endif
|
`endif
|
`ifdef DMEM_SIZE_1_KB
|
`ifdef DMEM_SIZE_1_KB
|
`define DMEM_AWIDTH 9
|
`define DMEM_AWIDTH 9
|
`define DMEM_SIZE 1024
|
`define DMEM_SIZE 1024
|
`endif
|
`endif
|
`ifdef DMEM_SIZE_512_B
|
`ifdef DMEM_SIZE_512_B
|
`define DMEM_AWIDTH 8
|
`define DMEM_AWIDTH 8
|
`define DMEM_SIZE 512
|
`define DMEM_SIZE 512
|
`endif
|
`endif
|
`ifdef DMEM_SIZE_256_B
|
`ifdef DMEM_SIZE_256_B
|
`define DMEM_AWIDTH 7
|
`define DMEM_AWIDTH 7
|
`define DMEM_SIZE 256
|
`define DMEM_SIZE 256
|
`endif
|
`endif
|
`ifdef DMEM_SIZE_128_B
|
`ifdef DMEM_SIZE_128_B
|
`define DMEM_AWIDTH 6
|
`define DMEM_AWIDTH 6
|
`define DMEM_SIZE 128
|
`define DMEM_SIZE 128
|
`endif
|
`endif
|
`ifdef DMEM_SIZE_CUSTOM
|
`ifdef DMEM_SIZE_CUSTOM
|
`define DMEM_AWIDTH `DMEM_CUSTOM_AWIDTH
|
`define DMEM_AWIDTH `DMEM_CUSTOM_AWIDTH
|
`define DMEM_SIZE `DMEM_CUSTOM_SIZE
|
`define DMEM_SIZE `DMEM_CUSTOM_SIZE
|
`endif
|
`endif
|
|
|
// Peripheral Memory Size
|
// Peripheral Memory Size
|
`ifdef PER_SIZE_32_KB
|
`ifdef PER_SIZE_32_KB
|
`define PER_AWIDTH 14
|
`define PER_AWIDTH 14
|
`define PER_SIZE 32768
|
`define PER_SIZE 32768
|
`endif
|
`endif
|
`ifdef PER_SIZE_16_KB
|
`ifdef PER_SIZE_16_KB
|
`define PER_AWIDTH 13
|
`define PER_AWIDTH 13
|
`define PER_SIZE 16384
|
`define PER_SIZE 16384
|
`endif
|
`endif
|
`ifdef PER_SIZE_8_KB
|
`ifdef PER_SIZE_8_KB
|
`define PER_AWIDTH 12
|
`define PER_AWIDTH 12
|
`define PER_SIZE 8192
|
`define PER_SIZE 8192
|
`endif
|
`endif
|
`ifdef PER_SIZE_4_KB
|
`ifdef PER_SIZE_4_KB
|
`define PER_AWIDTH 11
|
`define PER_AWIDTH 11
|
`define PER_SIZE 4096
|
`define PER_SIZE 4096
|
`endif
|
`endif
|
`ifdef PER_SIZE_2_KB
|
`ifdef PER_SIZE_2_KB
|
`define PER_AWIDTH 10
|
`define PER_AWIDTH 10
|
`define PER_SIZE 2048
|
`define PER_SIZE 2048
|
`endif
|
`endif
|
`ifdef PER_SIZE_1_KB
|
`ifdef PER_SIZE_1_KB
|
`define PER_AWIDTH 9
|
`define PER_AWIDTH 9
|
`define PER_SIZE 1024
|
`define PER_SIZE 1024
|
`endif
|
`endif
|
`ifdef PER_SIZE_512_B
|
`ifdef PER_SIZE_512_B
|
`define PER_AWIDTH 8
|
`define PER_AWIDTH 8
|
`define PER_SIZE 512
|
`define PER_SIZE 512
|
`endif
|
`endif
|
`ifdef PER_SIZE_CUSTOM
|
`ifdef PER_SIZE_CUSTOM
|
`define PER_AWIDTH `PER_CUSTOM_AWIDTH
|
`define PER_AWIDTH `PER_CUSTOM_AWIDTH
|
`define PER_SIZE `PER_CUSTOM_SIZE
|
`define PER_SIZE `PER_CUSTOM_SIZE
|
`endif
|
`endif
|
|
|
// Data Memory Base Adresses
|
// Data Memory Base Adresses
|
`define DMEM_BASE `PER_SIZE
|
`define DMEM_BASE `PER_SIZE
|
|
|
// Program & Data Memory most significant address bit (for 16 bit words)
|
// Program & Data Memory most significant address bit (for 16 bit words)
|
`define PMEM_MSB `PMEM_AWIDTH-1
|
`define PMEM_MSB `PMEM_AWIDTH-1
|
`define DMEM_MSB `DMEM_AWIDTH-1
|
`define DMEM_MSB `DMEM_AWIDTH-1
|
`define PER_MSB `PER_AWIDTH-1
|
`define PER_MSB `PER_AWIDTH-1
|
|
|
//
|
//
|
// STATES, REGISTER FIELDS, ...
|
// STATES, REGISTER FIELDS, ...
|
//======================================
|
//======================================
|
|
|
// Instructions type
|
// Instructions type
|
`define INST_SO 0
|
`define INST_SO 0
|
`define INST_JMP 1
|
`define INST_JMP 1
|
`define INST_TO 2
|
`define INST_TO 2
|
|
|
// Single-operand arithmetic
|
// Single-operand arithmetic
|
`define RRC 0
|
`define RRC 0
|
`define SWPB 1
|
`define SWPB 1
|
`define RRA 2
|
`define RRA 2
|
`define SXT 3
|
`define SXT 3
|
`define PUSH 4
|
`define PUSH 4
|
`define CALL 5
|
`define CALL 5
|
`define RETI 6
|
`define RETI 6
|
`define IRQ 7
|
`define IRQ 7
|
|
|
// Conditional jump
|
// Conditional jump
|
`define JNE 0
|
`define JNE 0
|
`define JEQ 1
|
`define JEQ 1
|
`define JNC 2
|
`define JNC 2
|
`define JC 3
|
`define JC 3
|
`define JN 4
|
`define JN 4
|
`define JGE 5
|
`define JGE 5
|
`define JL 6
|
`define JL 6
|
`define JMP 7
|
`define JMP 7
|
|
|
// Two-operand arithmetic
|
// Two-operand arithmetic
|
`define MOV 0
|
`define MOV 0
|
`define ADD 1
|
`define ADD 1
|
`define ADDC 2
|
`define ADDC 2
|
`define SUBC 3
|
`define SUBC 3
|
`define SUB 4
|
`define SUB 4
|
`define CMP 5
|
`define CMP 5
|
`define DADD 6
|
`define DADD 6
|
`define BIT 7
|
`define BIT 7
|
`define BIC 8
|
`define BIC 8
|
`define BIS 9
|
`define BIS 9
|
`define XOR 10
|
`define XOR 10
|
`define AND 11
|
`define AND 11
|
|
|
// Addressing modes
|
// Addressing modes
|
`define DIR 0
|
`define DIR 0
|
`define IDX 1
|
`define IDX 1
|
`define INDIR 2
|
`define INDIR 2
|
`define INDIR_I 3
|
`define INDIR_I 3
|
`define SYMB 4
|
`define SYMB 4
|
`define IMM 5
|
`define IMM 5
|
`define ABS 6
|
`define ABS 6
|
`define CONST 7
|
`define CONST 7
|
|
|
// Instruction state machine
|
// Instruction state machine
|
`define I_IRQ_FETCH 3'h0
|
`define I_IRQ_FETCH 3'h0
|
`define I_IRQ_DONE 3'h1
|
`define I_IRQ_DONE 3'h1
|
`define I_DEC 3'h2
|
`define I_DEC 3'h2
|
`define I_EXT1 3'h3
|
`define I_EXT1 3'h3
|
`define I_EXT2 3'h4
|
`define I_EXT2 3'h4
|
`define I_IDLE 3'h5
|
`define I_IDLE 3'h5
|
|
|
// Execution state machine
|
// Execution state machine
|
// (swapped E_IRQ_0 and E_IRQ_2 values to suppress glitch generation warning from lint tool)
|
// (swapped E_IRQ_0 and E_IRQ_2 values to suppress glitch generation warning from lint tool)
|
`define E_IRQ_0 4'h2
|
`define E_IRQ_0 4'h2
|
`define E_IRQ_1 4'h1
|
`define E_IRQ_1 4'h1
|
`define E_IRQ_2 4'h0
|
`define E_IRQ_2 4'h0
|
`define E_IRQ_3 4'h3
|
`define E_IRQ_3 4'h3
|
`define E_IRQ_4 4'h4
|
`define E_IRQ_4 4'h4
|
`define E_SRC_AD 4'h5
|
`define E_SRC_AD 4'h5
|
`define E_SRC_RD 4'h6
|
`define E_SRC_RD 4'h6
|
`define E_SRC_WR 4'h7
|
`define E_SRC_WR 4'h7
|
`define E_DST_AD 4'h8
|
`define E_DST_AD 4'h8
|
`define E_DST_RD 4'h9
|
`define E_DST_RD 4'h9
|
`define E_DST_WR 4'hA
|
`define E_DST_WR 4'hA
|
`define E_EXEC 4'hB
|
`define E_EXEC 4'hB
|
`define E_JUMP 4'hC
|
`define E_JUMP 4'hC
|
`define E_IDLE 4'hD
|
`define E_IDLE 4'hD
|
|
|
// ALU control signals
|
// ALU control signals
|
`define ALU_SRC_INV 0
|
`define ALU_SRC_INV 0
|
`define ALU_INC 1
|
`define ALU_INC 1
|
`define ALU_INC_C 2
|
`define ALU_INC_C 2
|
`define ALU_ADD 3
|
`define ALU_ADD 3
|
`define ALU_AND 4
|
`define ALU_AND 4
|
`define ALU_OR 5
|
`define ALU_OR 5
|
`define ALU_XOR 6
|
`define ALU_XOR 6
|
`define ALU_DADD 7
|
`define ALU_DADD 7
|
`define ALU_STAT_7 8
|
`define ALU_STAT_7 8
|
`define ALU_STAT_F 9
|
`define ALU_STAT_F 9
|
`define ALU_SHIFT 10
|
`define ALU_SHIFT 10
|
`define EXEC_NO_WR 11
|
`define EXEC_NO_WR 11
|
|
|
// Debug interface
|
// Debug interface
|
`define DBG_UART_WR 18
|
`define DBG_UART_WR 18
|
`define DBG_UART_BW 17
|
`define DBG_UART_BW 17
|
`define DBG_UART_ADDR 16:11
|
`define DBG_UART_ADDR 16:11
|
|
|
// Debug interface CPU_CTL register
|
// Debug interface CPU_CTL register
|
`define HALT 0
|
`define HALT 0
|
`define RUN 1
|
`define RUN 1
|
`define ISTEP 2
|
`define ISTEP 2
|
`define SW_BRK_EN 3
|
`define SW_BRK_EN 3
|
`define FRZ_BRK_EN 4
|
`define FRZ_BRK_EN 4
|
`define RST_BRK_EN 5
|
`define RST_BRK_EN 5
|
`define CPU_RST 6
|
`define CPU_RST 6
|
|
|
// Debug interface CPU_STAT register
|
// Debug interface CPU_STAT register
|
`define HALT_RUN 0
|
`define HALT_RUN 0
|
`define PUC_PND 1
|
`define PUC_PND 1
|
`define SWBRK_PND 3
|
`define SWBRK_PND 3
|
`define HWBRK0_PND 4
|
`define HWBRK0_PND 4
|
`define HWBRK1_PND 5
|
`define HWBRK1_PND 5
|
|
|
// Debug interface BRKx_CTL register
|
// Debug interface BRKx_CTL register
|
`define BRK_MODE_RD 0
|
`define BRK_MODE_RD 0
|
`define BRK_MODE_WR 1
|
`define BRK_MODE_WR 1
|
`define BRK_MODE 1:0
|
`define BRK_MODE 1:0
|
`define BRK_EN 2
|
`define BRK_EN 2
|
`define BRK_I_EN 3
|
`define BRK_I_EN 3
|
`define BRK_RANGE 4
|
`define BRK_RANGE 4
|
|
|
// Basic clock module: BCSCTL1 Control Register
|
// Basic clock module: BCSCTL1 Control Register
|
`define DIVAx 5:4
|
`define DIVAx 5:4
|
|
|
// Basic clock module: BCSCTL2 Control Register
|
// Basic clock module: BCSCTL2 Control Register
|
`define SELMx 7
|
`define SELMx 7
|
`define DIVMx 5:4
|
`define DIVMx 5:4
|
`define SELS 3
|
`define SELS 3
|
`define DIVSx 2:1
|
`define DIVSx 2:1
|
|
|
// MCLK Clock gate
|
// MCLK Clock gate
|
`ifdef CPUOFF_EN
|
`ifdef CPUOFF_EN
|
`define MCLK_CGATE
|
`define MCLK_CGATE
|
`else
|
`else
|
`ifdef MCLK_DIVIDER
|
`ifdef MCLK_DIVIDER
|
`define MCLK_CGATE
|
`define MCLK_CGATE
|
`endif
|
`endif
|
`endif
|
`endif
|
|
|
// SMCLK Clock gate
|
// SMCLK Clock gate
|
`ifdef SCG1_EN
|
`ifdef SCG1_EN
|
`define SMCLK_CGATE
|
`define SMCLK_CGATE
|
`else
|
`else
|
`ifdef SMCLK_DIVIDER
|
`ifdef SMCLK_DIVIDER
|
`define SMCLK_CGATE
|
`define SMCLK_CGATE
|
`endif
|
`endif
|
`endif
|
`endif
|
|
|
//
|
//
|
// DEBUG INTERFACE EXTRA CONFIGURATION
|
// DEBUG INTERFACE EXTRA CONFIGURATION
|
//======================================
|
//======================================
|
|
|
// Debug interface: CPU version
|
// Debug interface: CPU version
|
`define CPU_VERSION 3'h2
|
`define CPU_VERSION 3'h2
|
|
|
// Debug interface: Software breakpoint opcode
|
// Debug interface: Software breakpoint opcode
|
`define DBG_SWBRK_OP 16'h4343
|
`define DBG_SWBRK_OP 16'h4343
|
|
|
// Debug UART interface auto data synchronization
|
// Debug UART interface auto data synchronization
|
// If the following define is commented out, then
|
// If the following define is commented out, then
|
// the DBG_UART_BAUD and DBG_DCO_FREQ need to be properly
|
// the DBG_UART_BAUD and DBG_DCO_FREQ need to be properly
|
// defined.
|
// defined.
|
`define DBG_UART_AUTO_SYNC
|
`define DBG_UART_AUTO_SYNC
|
|
|
// Debug UART interface data rate
|
// Debug UART interface data rate
|
// In order to properly setup the UART debug interface, you
|
// In order to properly setup the UART debug interface, you
|
// need to specify the DCO_CLK frequency (DBG_DCO_FREQ) and
|
// need to specify the DCO_CLK frequency (DBG_DCO_FREQ) and
|
// the chosen BAUD rate from the UART interface.
|
// the chosen BAUD rate from the UART interface.
|
//
|
//
|
//`define DBG_UART_BAUD 9600
|
//`define DBG_UART_BAUD 9600
|
//`define DBG_UART_BAUD 19200
|
//`define DBG_UART_BAUD 19200
|
//`define DBG_UART_BAUD 38400
|
//`define DBG_UART_BAUD 38400
|
//`define DBG_UART_BAUD 57600
|
//`define DBG_UART_BAUD 57600
|
//`define DBG_UART_BAUD 115200
|
//`define DBG_UART_BAUD 115200
|
//`define DBG_UART_BAUD 230400
|
//`define DBG_UART_BAUD 230400
|
//`define DBG_UART_BAUD 460800
|
//`define DBG_UART_BAUD 460800
|
//`define DBG_UART_BAUD 576000
|
//`define DBG_UART_BAUD 576000
|
//`define DBG_UART_BAUD 921600
|
//`define DBG_UART_BAUD 921600
|
`define DBG_UART_BAUD 2000000
|
`define DBG_UART_BAUD 2000000
|
`define DBG_DCO_FREQ 20000000
|
`define DBG_DCO_FREQ 20000000
|
`define DBG_UART_CNT ((`DBG_DCO_FREQ/`DBG_UART_BAUD)-1)
|
`define DBG_UART_CNT ((`DBG_DCO_FREQ/`DBG_UART_BAUD)-1)
|
|
|
// Debug interface selection
|
|
// `define DBG_UART -> Enable UART (8N1) debug interface
|
|
// `define DBG_JTAG -> DON'T UNCOMMENT, NOT SUPPORTED
|
|
//
|
|
`define DBG_UART
|
|
//`define DBG_JTAG
|
|
|
|
// Debug interface input synchronizer
|
// Debug interface input synchronizer
|
`define SYNC_DBG_UART_RXD
|
`define SYNC_DBG_UART_RXD
|
|
|
// Enable/Disable the hardware breakpoint RANGE mode
|
// Enable/Disable the hardware breakpoint RANGE mode
|
`ifdef DBG_HWBRK_RANGE
|
`ifdef DBG_HWBRK_RANGE
|
`define HWBRK_RANGE 1'b1
|
`define HWBRK_RANGE 1'b1
|
`else
|
`else
|
`define HWBRK_RANGE 1'b0
|
`define HWBRK_RANGE 1'b0
|
`endif
|
`endif
|
|
|
// Counter width for the debug interface UART
|
// Counter width for the debug interface UART
|
`define DBG_UART_XFER_CNT_W 16
|
`define DBG_UART_XFER_CNT_W 16
|
|
|
// Check configuration
|
// Check configuration
|
`ifdef DBG_EN
|
`ifdef DBG_EN
|
`ifdef DBG_UART
|
`ifdef DBG_UART
|
`ifdef DBG_JTAG
|
`ifdef DBG_I2C
|
CONFIGURATION ERROR: JTAG AND UART DEBUG INTERFACE ARE BOTH ENABLED
|
CONFIGURATION ERROR: I2C AND UART DEBUG INTERFACE ARE BOTH ENABLED
|
`endif
|
`endif
|
`else
|
`else
|
`ifdef DBG_JTAG
|
`ifdef DBG_I2C
|
CONFIGURATION ERROR: JTAG INTERFACE NOT SUPPORTED
|
|
`else
|
`else
|
CONFIGURATION ERROR: JTAG OR UART DEBUG INTERFACE SHOULD BE ENABLED
|
CONFIGURATION ERROR: I2C OR UART DEBUG INTERFACE SHOULD BE ENABLED
|
`endif
|
`endif
|
`endif
|
`endif
|
`endif
|
`endif
|
|
|
//
|
//
|
// MULTIPLIER CONFIGURATION
|
// MULTIPLIER CONFIGURATION
|
//======================================
|
//======================================
|
|
|
// If uncommented, the following define selects
|
// If uncommented, the following define selects
|
// the 16x16 multiplier (1 cycle) instead of the
|
// the 16x16 multiplier (1 cycle) instead of the
|
// default 16x8 multplier (2 cycles)
|
// default 16x8 multplier (2 cycles)
|
//`define MPY_16x16
|
//`define MPY_16x16
|
|
|
//======================================
|
//======================================
|
// CONFIGURATION CHECKS
|
// CONFIGURATION CHECKS
|
//======================================
|
//======================================
|
`ifdef LFXT_DOMAIN
|
`ifdef LFXT_DOMAIN
|
`else
|
`else
|
`ifdef MCLK_MUX
|
`ifdef MCLK_MUX
|
CONFIGURATION ERROR: THE MCLK_MUX CAN ONLY BE ENABLED IF THE LFXT_DOMAIN IS ENABLED AS WELL
|
CONFIGURATION ERROR: THE MCLK_MUX CAN ONLY BE ENABLED IF THE LFXT_DOMAIN IS ENABLED AS WELL
|
`endif
|
`endif
|
`ifdef SMCLK_MUX
|
`ifdef SMCLK_MUX
|
CONFIGURATION ERROR: THE SMCLK_MUX CAN ONLY BE ENABLED IF THE LFXT_DOMAIN IS ENABLED AS WELL
|
CONFIGURATION ERROR: THE SMCLK_MUX CAN ONLY BE ENABLED IF THE LFXT_DOMAIN IS ENABLED AS WELL
|
`endif
|
`endif
|
`ifdef WATCHDOG_MUX
|
`ifdef WATCHDOG_MUX
|
CONFIGURATION ERROR: THE WATCHDOG_MUX CAN ONLY BE ENABLED IF THE LFXT_DOMAIN IS ENABLED AS WELL
|
CONFIGURATION ERROR: THE WATCHDOG_MUX CAN ONLY BE ENABLED IF THE LFXT_DOMAIN IS ENABLED AS WELL
|
`else
|
`else
|
`ifdef WATCHDOG_NOMUX_ACLK
|
`ifdef WATCHDOG_NOMUX_ACLK
|
CONFIGURATION ERROR: THE WATCHDOG_NOMUX_ACLK CAN ONLY BE ENABLED IF THE LFXT_DOMAIN IS ENABLED AS WELL
|
CONFIGURATION ERROR: THE WATCHDOG_NOMUX_ACLK CAN ONLY BE ENABLED IF THE LFXT_DOMAIN IS ENABLED AS WELL
|
`endif
|
`endif
|
`endif
|
`endif
|
`ifdef OSCOFF_EN
|
`ifdef OSCOFF_EN
|
CONFIGURATION ERROR: THE OSCOFF LOW POWER MODE CAN ONLY BE ENABLED IF THE LFXT_DOMAIN IS ENABLED AS WELL
|
CONFIGURATION ERROR: THE OSCOFF LOW POWER MODE CAN ONLY BE ENABLED IF THE LFXT_DOMAIN IS ENABLED AS WELL
|
`endif
|
`endif
|
`endif
|
`endif
|
|
|