Line 20... |
Line 20... |
// along with this source; if not, write to the Free Software Foundation,
|
// along with this source; if not, write to the Free Software Foundation,
|
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
//
|
//
|
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
//
|
//
|
// *File Name: openMSP430_fpga.v
|
// *File Name: omsp_system_1.v
|
//
|
//
|
// *Module Description:
|
// *Module Description:
|
// openMSP430 FPGA Top-level for the Avnet LX9 Microboard
|
// openMSP430 System 0.
|
|
// This core is dedicated to communication and
|
|
// display (i.e. UART, LEDs and 7-segment modport)
|
|
// It can also read the switches value.
|
//
|
//
|
// *Author(s):
|
// *Author(s):
|
// - Ricardo Ribalda, ricardo.ribalda@gmail.com
|
|
// - Olivier Girard, olgirard@gmail.com
|
// - Olivier Girard, olgirard@gmail.com
|
//
|
//
|
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
`include "openmsp430/openMSP430_defines.v"
|
`include "openmsp430/openMSP430_defines.v"
|
|
|
Line 38... |
Line 40... |
|
|
// Clock & Reset
|
// Clock & Reset
|
dco_clk, // Fast oscillator (fast clock)
|
dco_clk, // Fast oscillator (fast clock)
|
reset_n, // Reset Pin (low active, asynchronous and non-glitchy)
|
reset_n, // Reset Pin (low active, asynchronous and non-glitchy)
|
|
|
// Serial Debug Interface (UART)
|
|
dbg_uart_rxd, // Debug interface: UART RXD (asynchronous)
|
|
dbg_uart_txd, // Debug interface: UART TXD
|
|
|
|
// Serial Debug Interface (I2C)
|
// Serial Debug Interface (I2C)
|
dbg_i2c_addr, // Debug interface: I2C Address
|
dbg_i2c_addr, // Debug interface: I2C Address
|
dbg_i2c_broadcast, // Debug interface: I2C Broadcast Address (for multicore systems)
|
dbg_i2c_broadcast, // Debug interface: I2C Broadcast Address (for multicore systems)
|
dbg_i2c_scl, // Debug interface: I2C SCL
|
dbg_i2c_scl, // Debug interface: I2C SCL
|
dbg_i2c_sda_in, // Debug interface: I2C SDA IN
|
dbg_i2c_sda_in, // Debug interface: I2C SDA IN
|
Line 76... |
Line 74... |
|
|
// Clock & Reset
|
// Clock & Reset
|
input dco_clk; // Fast oscillator (fast clock)
|
input dco_clk; // Fast oscillator (fast clock)
|
input reset_n; // Reset Pin (low active, asynchronous and non-glitchy)
|
input reset_n; // Reset Pin (low active, asynchronous and non-glitchy)
|
|
|
// Serial Debug Interface (UART)
|
|
input dbg_uart_rxd; // Debug interface: UART RXD (asynchronous)
|
|
output dbg_uart_txd; // Debug interface: UART TXD
|
|
|
|
// Serial Debug Interface (I2C)
|
// Serial Debug Interface (I2C)
|
input [6:0] dbg_i2c_addr; // Debug interface: I2C Address
|
input [6:0] dbg_i2c_addr; // Debug interface: I2C Address
|
input [6:0] dbg_i2c_broadcast; // Debug interface: I2C Broadcast Address (for multicore systems)
|
input [6:0] dbg_i2c_broadcast; // Debug interface: I2C Broadcast Address (for multicore systems)
|
input dbg_i2c_scl; // Debug interface: I2C SCL
|
input dbg_i2c_scl; // Debug interface: I2C SCL
|
input dbg_i2c_sda_in; // Debug interface: I2C SDA IN
|
input dbg_i2c_sda_in; // Debug interface: I2C SDA IN
|
Line 107... |
Line 101... |
input uart_rxd; // UART Data Receive (RXD)
|
input uart_rxd; // UART Data Receive (RXD)
|
output uart_txd; // UART Data Transmit (TXD)
|
output uart_txd; // UART Data Transmit (TXD)
|
|
|
// Switches & LEDs
|
// Switches & LEDs
|
input [3:0] switch; // Input switches
|
input [3:0] switch; // Input switches
|
output [3:0] led; // LEDs
|
output [1:0] led; // LEDs
|
|
|
|
|
//=============================================================================
|
//=============================================================================
|
// 1) INTERNAL WIRES/REGISTERS/PARAMETERS DECLARATION
|
// 1) INTERNAL WIRES/REGISTERS/PARAMETERS DECLARATION
|
//=============================================================================
|
//=============================================================================
|
Line 122... |
Line 116... |
wire smclk_en;
|
wire smclk_en;
|
wire puc_rst;
|
wire puc_rst;
|
|
|
// Debug interface
|
// Debug interface
|
wire dbg_freeze;
|
wire dbg_freeze;
|
wire dbg_uart_txd;
|
|
wire dbg_uart_rxd;
|
|
|
|
// Data memory
|
// Data memory
|
wire [`DMEM_MSB:0] dmem_addr;
|
wire [`DMEM_MSB:0] dmem_addr;
|
wire dmem_cen;
|
wire dmem_cen;
|
wire [15:0] dmem_din;
|
wire [15:0] dmem_din;
|
Line 174... |
Line 166... |
//=============================================================================
|
//=============================================================================
|
// 2) OPENMSP430 CORE
|
// 2) OPENMSP430 CORE
|
//=============================================================================
|
//=============================================================================
|
|
|
openMSP430 #(.INST_NR (0),
|
openMSP430 #(.INST_NR (0),
|
.TOTAL_NR(0)) openMSP430_0 (
|
.TOTAL_NR(1)) openMSP430_0 (
|
|
|
// OUTPUTs
|
// OUTPUTs
|
.aclk (), // ASIC ONLY: ACLK
|
.aclk (), // ASIC ONLY: ACLK
|
.aclk_en (aclk_en), // FPGA ONLY: ACLK enable
|
.aclk_en (aclk_en), // FPGA ONLY: ACLK enable
|
.dbg_freeze (dbg_freeze), // Freeze peripherals
|
.dbg_freeze (dbg_freeze), // Freeze peripherals
|
.dbg_i2c_sda_out (dbg_i2c_sda_out), // Debug interface: I2C SDA OUT
|
.dbg_i2c_sda_out (dbg_i2c_sda_out), // Debug interface: I2C SDA OUT
|
.dbg_uart_txd (dbg_uart_txd), // Debug interface: UART TXD
|
.dbg_uart_txd (), // Debug interface: UART TXD
|
.dco_enable (), // ASIC ONLY: Fast oscillator enable
|
.dco_enable (), // ASIC ONLY: Fast oscillator enable
|
.dco_wkup (), // ASIC ONLY: Fast oscillator wake-up (asynchronous)
|
.dco_wkup (), // ASIC ONLY: Fast oscillator wake-up (asynchronous)
|
.dmem_addr (dmem_addr), // Data Memory address
|
.dmem_addr (dmem_addr), // Data Memory address
|
.dmem_cen (dmem_cen), // Data Memory chip enable (low active)
|
.dmem_cen (dmem_cen), // Data Memory chip enable (low active)
|
.dmem_din (dmem_din), // Data Memory data input
|
.dmem_din (dmem_din), // Data Memory data input
|
Line 211... |
Line 203... |
.dbg_en (1'b1), // Debug interface enable (asynchronous and non-glitchy)
|
.dbg_en (1'b1), // Debug interface enable (asynchronous and non-glitchy)
|
.dbg_i2c_addr (dbg_i2c_addr), // Debug interface: I2C Address
|
.dbg_i2c_addr (dbg_i2c_addr), // Debug interface: I2C Address
|
.dbg_i2c_broadcast (dbg_i2c_broadcast), // Debug interface: I2C Broadcast Address (for multicore systems)
|
.dbg_i2c_broadcast (dbg_i2c_broadcast), // Debug interface: I2C Broadcast Address (for multicore systems)
|
.dbg_i2c_scl (dbg_i2c_scl), // Debug interface: I2C SCL
|
.dbg_i2c_scl (dbg_i2c_scl), // Debug interface: I2C SCL
|
.dbg_i2c_sda_in (dbg_i2c_sda_in), // Debug interface: I2C SDA IN
|
.dbg_i2c_sda_in (dbg_i2c_sda_in), // Debug interface: I2C SDA IN
|
.dbg_uart_rxd (dbg_uart_rxd), // Debug interface: UART RXD (asynchronous)
|
.dbg_uart_rxd (1'b1), // Debug interface: UART RXD (asynchronous)
|
.dco_clk (dco_clk), // Fast oscillator (fast clock)
|
.dco_clk (dco_clk), // Fast oscillator (fast clock)
|
.dmem_dout (dmem_dout), // Data Memory data output
|
.dmem_dout (dmem_dout), // Data Memory data output
|
.irq (irq_bus), // Maskable interrupts
|
.irq (irq_bus), // Maskable interrupts
|
.lfxt_clk (1'b0), // Low frequency oscillator (typ 32kHz)
|
.lfxt_clk (1'b0), // Low frequency oscillator (typ 32kHz)
|
.nmi (nmi), // Non-maskable interrupt (asynchronous)
|
.nmi (nmi), // Non-maskable interrupt (asynchronous)
|
Line 280... |
Line 272... |
.per_we (per_we), // Peripheral write enable (high active)
|
.per_we (per_we), // Peripheral write enable (high active)
|
.puc_rst (puc_rst) // Main system reset
|
.puc_rst (puc_rst) // Main system reset
|
);
|
);
|
|
|
// Assign LEDs
|
// Assign LEDs
|
assign led = p2_dout[3:0] & p2_dout_en[3:0];
|
assign led = p2_dout[1:0] & p2_dout_en[1:0];
|
|
|
// Assign Switches
|
// Assign Switches
|
assign p1_din[7:4] = 4'h0;
|
assign p1_din[7:4] = 4'h0;
|
assign p1_din[3:0] = switch;
|
assign p1_din[3:0] = switch;
|
|
|
Line 371... |
Line 363... |
1'b0, // Vector 10 (0xFFF4) - Watchdog -
|
1'b0, // Vector 10 (0xFFF4) - Watchdog -
|
irq_ta0, // Vector 9 (0xFFF2)
|
irq_ta0, // Vector 9 (0xFFF2)
|
irq_ta1, // Vector 8 (0xFFF0)
|
irq_ta1, // Vector 8 (0xFFF0)
|
irq_uart_rx, // Vector 7 (0xFFEE)
|
irq_uart_rx, // Vector 7 (0xFFEE)
|
irq_uart_tx, // Vector 6 (0xFFEC)
|
irq_uart_tx, // Vector 6 (0xFFEC)
|
1'b0, // Vector 5 (0xFFEA)
|
1'b0, // Vector 5 (0xFFEA) - Reserved (Timer-A 0 from system 1)
|
1'b0, // Vector 4 (0xFFE8)
|
1'b0, // Vector 4 (0xFFE8) - Reserved (Timer-A 1 from system 1)
|
irq_port2, // Vector 3 (0xFFE6)
|
irq_port2, // Vector 3 (0xFFE6)
|
irq_port1, // Vector 2 (0xFFE4)
|
irq_port1, // Vector 2 (0xFFE4)
|
1'b0, // Vector 1 (0xFFE2)
|
1'b0, // Vector 1 (0xFFE2) - Reserved (Port 2 from system 1)
|
1'b0}; // Vector 0 (0xFFE0)
|
1'b0}; // Vector 0 (0xFFE0) - Reserved (Port 1 from system 1)
|
|
|
|
|
endmodule // omsp_system_0
|
endmodule // omsp_system_0
|
|
|
|
|