| 1 | 157 | olivier.gi | //----------------------------------------------------------------------------
 | 
      
         | 2 |  |  | // Copyright (C) 2011 Authors
 | 
      
         | 3 |  |  | //
 | 
      
         | 4 |  |  | // This source file may be used and distributed without restriction provided
 | 
      
         | 5 |  |  | // that this copyright statement is not removed from the file and that any
 | 
      
         | 6 |  |  | // derivative work contains the original copyright notice and the associated
 | 
      
         | 7 |  |  | // disclaimer.
 | 
      
         | 8 |  |  | //
 | 
      
         | 9 |  |  | // This source file is free software; you can redistribute it and/or modify
 | 
      
         | 10 |  |  | // it under the terms of the GNU Lesser General Public License as published
 | 
      
         | 11 |  |  | // by the Free Software Foundation; either version 2.1 of the License, or
 | 
      
         | 12 |  |  | // (at your option) any later version.
 | 
      
         | 13 |  |  | //
 | 
      
         | 14 |  |  | // This source is distributed in the hope that it will be useful, but WITHOUT
 | 
      
         | 15 |  |  | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 | 
      
         | 16 |  |  | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
 | 
      
         | 17 |  |  | // License for more details.
 | 
      
         | 18 |  |  | //
 | 
      
         | 19 |  |  | // You should have received a copy of the GNU Lesser General Public License
 | 
      
         | 20 |  |  | // along with this source; if not, write to the Free Software Foundation,
 | 
      
         | 21 |  |  | // Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 | 
      
         | 22 |  |  | //
 | 
      
         | 23 |  |  | //----------------------------------------------------------------------------
 | 
      
         | 24 | 202 | olivier.gi | //
 | 
      
         | 25 | 167 | olivier.gi | // *File Name: omsp_system_1.v
 | 
      
         | 26 | 202 | olivier.gi | //
 | 
      
         | 27 | 157 | olivier.gi | // *Module Description:
 | 
      
         | 28 | 167 | olivier.gi | //                      openMSP430 System 0.
 | 
      
         | 29 |  |  | //                      This core is dedicated to communication and
 | 
      
         | 30 |  |  | //                      display (i.e. UART, LEDs and 7-segment modport)
 | 
      
         | 31 |  |  | //                      It can also read the switches value.
 | 
      
         | 32 | 157 | olivier.gi | //
 | 
      
         | 33 |  |  | // *Author(s):
 | 
      
         | 34 |  |  | //              - Olivier Girard,    olgirard@gmail.com
 | 
      
         | 35 |  |  | //
 | 
      
         | 36 |  |  | //----------------------------------------------------------------------------
 | 
      
         | 37 |  |  | `include "openmsp430/openMSP430_defines.v"
 | 
      
         | 38 |  |  |  
 | 
      
         | 39 |  |  | module omsp_system_0 (
 | 
      
         | 40 |  |  |  
 | 
      
         | 41 |  |  | // Clock & Reset
 | 
      
         | 42 |  |  |     dco_clk,                               // Fast oscillator (fast clock)
 | 
      
         | 43 |  |  |     reset_n,                               // Reset Pin (low active, asynchronous and non-glitchy)
 | 
      
         | 44 |  |  |  
 | 
      
         | 45 |  |  | // Serial Debug Interface (I2C)
 | 
      
         | 46 |  |  |     dbg_i2c_addr,                          // Debug interface: I2C Address
 | 
      
         | 47 |  |  |     dbg_i2c_broadcast,                     // Debug interface: I2C Broadcast Address (for multicore systems)
 | 
      
         | 48 |  |  |     dbg_i2c_scl,                           // Debug interface: I2C SCL
 | 
      
         | 49 |  |  |     dbg_i2c_sda_in,                        // Debug interface: I2C SDA IN
 | 
      
         | 50 |  |  |     dbg_i2c_sda_out,                       // Debug interface: I2C SDA OUT
 | 
      
         | 51 |  |  |  
 | 
      
         | 52 |  |  | // Data Memory
 | 
      
         | 53 |  |  |     dmem_addr,                             // Data Memory address
 | 
      
         | 54 |  |  |     dmem_cen,                              // Data Memory chip enable (low active)
 | 
      
         | 55 |  |  |     dmem_din,                              // Data Memory data input
 | 
      
         | 56 |  |  |     dmem_wen,                              // Data Memory write enable (low active)
 | 
      
         | 57 |  |  |     dmem_dout,                             // Data Memory data output
 | 
      
         | 58 |  |  |  
 | 
      
         | 59 |  |  | // Program Memory
 | 
      
         | 60 |  |  |     pmem_addr,                             // Program Memory address
 | 
      
         | 61 |  |  |     pmem_cen,                              // Program Memory chip enable (low active)
 | 
      
         | 62 |  |  |     pmem_din,                              // Program Memory data input (optional)
 | 
      
         | 63 |  |  |     pmem_wen,                              // Program Memory write enable (low active) (optional)
 | 
      
         | 64 |  |  |     pmem_dout,                             // Program Memory data output
 | 
      
         | 65 |  |  |  
 | 
      
         | 66 |  |  | // UART
 | 
      
         | 67 |  |  |     uart_rxd,                              // UART Data Receive (RXD)
 | 
      
         | 68 |  |  |     uart_txd,                              // UART Data Transmit (TXD)
 | 
      
         | 69 |  |  |  
 | 
      
         | 70 |  |  | // Switches & LEDs
 | 
      
         | 71 |  |  |     switch,                                // Input switches
 | 
      
         | 72 |  |  |     led                                    // LEDs
 | 
      
         | 73 |  |  | );
 | 
      
         | 74 |  |  |  
 | 
      
         | 75 |  |  | // Clock & Reset
 | 
      
         | 76 |  |  | input                dco_clk;              // Fast oscillator (fast clock)
 | 
      
         | 77 |  |  | input                reset_n;              // Reset Pin (low active, asynchronous and non-glitchy)
 | 
      
         | 78 |  |  |  
 | 
      
         | 79 |  |  | // Serial Debug Interface (I2C)
 | 
      
         | 80 |  |  | input          [6:0] dbg_i2c_addr;         // Debug interface: I2C Address
 | 
      
         | 81 |  |  | input          [6:0] dbg_i2c_broadcast;    // Debug interface: I2C Broadcast Address (for multicore systems)
 | 
      
         | 82 |  |  | input                dbg_i2c_scl;          // Debug interface: I2C SCL
 | 
      
         | 83 |  |  | input                dbg_i2c_sda_in;       // Debug interface: I2C SDA IN
 | 
      
         | 84 |  |  | output               dbg_i2c_sda_out;      // Debug interface: I2C SDA OUT
 | 
      
         | 85 |  |  |  
 | 
      
         | 86 |  |  | // Data Memory
 | 
      
         | 87 |  |  | input         [15:0] dmem_dout;            // Data Memory data output
 | 
      
         | 88 |  |  | output [`DMEM_MSB:0] dmem_addr;            // Data Memory address
 | 
      
         | 89 |  |  | output               dmem_cen;             // Data Memory chip enable (low active)
 | 
      
         | 90 |  |  | output        [15:0] dmem_din;             // Data Memory data input
 | 
      
         | 91 |  |  | output         [1:0] dmem_wen;             // Data Memory write enable (low active)
 | 
      
         | 92 |  |  |  
 | 
      
         | 93 |  |  | // Program Memory
 | 
      
         | 94 |  |  | input         [15:0] pmem_dout;            // Program Memory data output
 | 
      
         | 95 |  |  | output [`PMEM_MSB:0] pmem_addr;            // Program Memory address
 | 
      
         | 96 |  |  | output               pmem_cen;             // Program Memory chip enable (low active)
 | 
      
         | 97 |  |  | output        [15:0] pmem_din;             // Program Memory data input (optional)
 | 
      
         | 98 |  |  | output         [1:0] pmem_wen;             // Program Memory write enable (low active) (optional)
 | 
      
         | 99 |  |  |  
 | 
      
         | 100 |  |  | // UART
 | 
      
         | 101 |  |  | input                uart_rxd;             // UART Data Receive (RXD)
 | 
      
         | 102 |  |  | output               uart_txd;             // UART Data Transmit (TXD)
 | 
      
         | 103 |  |  |  
 | 
      
         | 104 |  |  | // Switches & LEDs
 | 
      
         | 105 |  |  | input          [3:0] switch;               // Input switches
 | 
      
         | 106 | 167 | olivier.gi | output         [1:0] led;                  // LEDs
 | 
      
         | 107 | 157 | olivier.gi |  
 | 
      
         | 108 | 202 | olivier.gi |  
 | 
      
         | 109 | 157 | olivier.gi | //=============================================================================
 | 
      
         | 110 |  |  | // 1)  INTERNAL WIRES/REGISTERS/PARAMETERS DECLARATION
 | 
      
         | 111 |  |  | //=============================================================================
 | 
      
         | 112 |  |  |  
 | 
      
         | 113 |  |  | // Clock & Reset
 | 
      
         | 114 |  |  | wire               mclk;
 | 
      
         | 115 |  |  | wire               aclk_en;
 | 
      
         | 116 |  |  | wire               smclk_en;
 | 
      
         | 117 |  |  | wire               puc_rst;
 | 
      
         | 118 |  |  |  
 | 
      
         | 119 |  |  | // Debug interface
 | 
      
         | 120 |  |  | wire               dbg_freeze;
 | 
      
         | 121 |  |  |  
 | 
      
         | 122 |  |  | // Data memory
 | 
      
         | 123 |  |  | wire [`DMEM_MSB:0] dmem_addr;
 | 
      
         | 124 |  |  | wire               dmem_cen;
 | 
      
         | 125 |  |  | wire        [15:0] dmem_din;
 | 
      
         | 126 |  |  | wire         [1:0] dmem_wen;
 | 
      
         | 127 |  |  | wire        [15:0] dmem_dout;
 | 
      
         | 128 |  |  |  
 | 
      
         | 129 |  |  | // Program memory
 | 
      
         | 130 |  |  | wire [`PMEM_MSB:0] pmem_addr;
 | 
      
         | 131 |  |  | wire               pmem_cen;
 | 
      
         | 132 |  |  | wire        [15:0] pmem_din;
 | 
      
         | 133 |  |  | wire         [1:0] pmem_wen;
 | 
      
         | 134 |  |  | wire        [15:0] pmem_dout;
 | 
      
         | 135 |  |  |  
 | 
      
         | 136 |  |  | // Peripheral bus
 | 
      
         | 137 |  |  | wire        [13:0] per_addr;
 | 
      
         | 138 |  |  | wire        [15:0] per_din;
 | 
      
         | 139 |  |  | wire         [1:0] per_we;
 | 
      
         | 140 |  |  | wire               per_en;
 | 
      
         | 141 |  |  | wire        [15:0] per_dout;
 | 
      
         | 142 |  |  |  
 | 
      
         | 143 |  |  | // Interrupts
 | 
      
         | 144 |  |  | wire        [13:0] irq_acc;
 | 
      
         | 145 |  |  | wire        [13:0] irq_bus;
 | 
      
         | 146 |  |  | wire               nmi;
 | 
      
         | 147 |  |  |  
 | 
      
         | 148 |  |  | // GPIO
 | 
      
         | 149 |  |  | wire         [7:0] p1_din;
 | 
      
         | 150 |  |  | wire         [7:0] p1_dout;
 | 
      
         | 151 |  |  | wire         [7:0] p1_dout_en;
 | 
      
         | 152 |  |  | wire         [7:0] p1_sel;
 | 
      
         | 153 |  |  | wire         [7:0] p2_din;
 | 
      
         | 154 |  |  | wire         [7:0] p2_dout;
 | 
      
         | 155 |  |  | wire         [7:0] p2_dout_en;
 | 
      
         | 156 |  |  | wire         [7:0] p2_sel;
 | 
      
         | 157 |  |  | wire        [15:0] per_dout_gpio;
 | 
      
         | 158 |  |  |  
 | 
      
         | 159 |  |  | // Timer A
 | 
      
         | 160 |  |  | wire        [15:0] per_dout_tA;
 | 
      
         | 161 |  |  |  
 | 
      
         | 162 |  |  | // Hardware UART
 | 
      
         | 163 |  |  | wire        [15:0] per_dout_uart;
 | 
      
         | 164 |  |  |  
 | 
      
         | 165 |  |  |  
 | 
      
         | 166 |  |  | //=============================================================================
 | 
      
         | 167 |  |  | // 2)  OPENMSP430 CORE
 | 
      
         | 168 |  |  | //=============================================================================
 | 
      
         | 169 |  |  |  
 | 
      
         | 170 |  |  | openMSP430 #(.INST_NR (0),
 | 
      
         | 171 | 167 | olivier.gi |              .TOTAL_NR(1)) openMSP430_0 (
 | 
      
         | 172 | 157 | olivier.gi |  
 | 
      
         | 173 |  |  | // OUTPUTs
 | 
      
         | 174 |  |  |     .aclk              (),                   // ASIC ONLY: ACLK
 | 
      
         | 175 |  |  |     .aclk_en           (aclk_en),            // FPGA ONLY: ACLK enable
 | 
      
         | 176 |  |  |     .dbg_freeze        (dbg_freeze),         // Freeze peripherals
 | 
      
         | 177 |  |  |     .dbg_i2c_sda_out   (dbg_i2c_sda_out),    // Debug interface: I2C SDA OUT
 | 
      
         | 178 | 167 | olivier.gi |     .dbg_uart_txd      (),                   // Debug interface: UART TXD
 | 
      
         | 179 | 157 | olivier.gi |     .dco_enable        (),                   // ASIC ONLY: Fast oscillator enable
 | 
      
         | 180 |  |  |     .dco_wkup          (),                   // ASIC ONLY: Fast oscillator wake-up (asynchronous)
 | 
      
         | 181 |  |  |     .dmem_addr         (dmem_addr),          // Data Memory address
 | 
      
         | 182 |  |  |     .dmem_cen          (dmem_cen),           // Data Memory chip enable (low active)
 | 
      
         | 183 |  |  |     .dmem_din          (dmem_din),           // Data Memory data input
 | 
      
         | 184 |  |  |     .dmem_wen          (dmem_wen),           // Data Memory write enable (low active)
 | 
      
         | 185 |  |  |     .irq_acc           (irq_acc),            // Interrupt request accepted (one-hot signal)
 | 
      
         | 186 |  |  |     .lfxt_enable       (),                   // ASIC ONLY: Low frequency oscillator enable
 | 
      
         | 187 |  |  |     .lfxt_wkup         (),                   // ASIC ONLY: Low frequency oscillator wake-up (asynchronous)
 | 
      
         | 188 |  |  |     .mclk              (mclk),               // Main system clock
 | 
      
         | 189 | 202 | olivier.gi |     .dma_dout          (),                   // Direct Memory Access data output
 | 
      
         | 190 |  |  |     .dma_ready         (),                   // Direct Memory Access is complete
 | 
      
         | 191 |  |  |     .dma_resp          (),                   // Direct Memory Access response (0:Okay / 1:Error)
 | 
      
         | 192 | 157 | olivier.gi |     .per_addr          (per_addr),           // Peripheral address
 | 
      
         | 193 |  |  |     .per_din           (per_din),            // Peripheral data input
 | 
      
         | 194 |  |  |     .per_we            (per_we),             // Peripheral write enable (high active)
 | 
      
         | 195 |  |  |     .per_en            (per_en),             // Peripheral enable (high active)
 | 
      
         | 196 |  |  |     .pmem_addr         (pmem_addr),          // Program Memory address
 | 
      
         | 197 |  |  |     .pmem_cen          (pmem_cen),           // Program Memory chip enable (low active)
 | 
      
         | 198 |  |  |     .pmem_din          (pmem_din),           // Program Memory data input (optional)
 | 
      
         | 199 |  |  |     .pmem_wen          (pmem_wen),           // Program Memory write enable (low active) (optional)
 | 
      
         | 200 |  |  |     .puc_rst           (puc_rst),            // Main system reset
 | 
      
         | 201 |  |  |     .smclk             (),                   // ASIC ONLY: SMCLK
 | 
      
         | 202 |  |  |     .smclk_en          (smclk_en),           // FPGA ONLY: SMCLK enable
 | 
      
         | 203 |  |  |  
 | 
      
         | 204 |  |  | // INPUTs
 | 
      
         | 205 |  |  |     .cpu_en            (1'b1),               // Enable CPU code execution (asynchronous and non-glitchy)
 | 
      
         | 206 |  |  |     .dbg_en            (1'b1),               // Debug interface enable (asynchronous and non-glitchy)
 | 
      
         | 207 |  |  |     .dbg_i2c_addr      (dbg_i2c_addr),       // Debug interface: I2C Address
 | 
      
         | 208 |  |  |     .dbg_i2c_broadcast (dbg_i2c_broadcast),  // Debug interface: I2C Broadcast Address (for multicore systems)
 | 
      
         | 209 |  |  |     .dbg_i2c_scl       (dbg_i2c_scl),        // Debug interface: I2C SCL
 | 
      
         | 210 |  |  |     .dbg_i2c_sda_in    (dbg_i2c_sda_in),     // Debug interface: I2C SDA IN
 | 
      
         | 211 | 167 | olivier.gi |     .dbg_uart_rxd      (1'b1),               // Debug interface: UART RXD (asynchronous)
 | 
      
         | 212 | 157 | olivier.gi |     .dco_clk           (dco_clk),            // Fast oscillator (fast clock)
 | 
      
         | 213 |  |  |     .dmem_dout         (dmem_dout),          // Data Memory data output
 | 
      
         | 214 |  |  |     .irq               (irq_bus),            // Maskable interrupts
 | 
      
         | 215 |  |  |     .lfxt_clk          (1'b0),               // Low frequency oscillator (typ 32kHz)
 | 
      
         | 216 | 202 | olivier.gi |     .dma_addr          (15'h0000),           // Direct Memory Access address
 | 
      
         | 217 |  |  |     .dma_din           (16'h0000),           // Direct Memory Access data input
 | 
      
         | 218 |  |  |     .dma_en            (1'b0),               // Direct Memory Access enable (high active)
 | 
      
         | 219 |  |  |     .dma_priority      (1'b0),               // Direct Memory Access priority (0:low / 1:high)
 | 
      
         | 220 |  |  |     .dma_we            (2'b00),              // Direct Memory Access write byte enable (high active)
 | 
      
         | 221 |  |  |     .dma_wkup          (1'b0),               // ASIC ONLY: DMA Sub-System Wake-up (asynchronous and non-glitchy)
 | 
      
         | 222 | 157 | olivier.gi |     .nmi               (nmi),                // Non-maskable interrupt (asynchronous)
 | 
      
         | 223 |  |  |     .per_dout          (per_dout),           // Peripheral data output
 | 
      
         | 224 |  |  |     .pmem_dout         (pmem_dout),          // Program Memory data output
 | 
      
         | 225 |  |  |     .reset_n           (reset_n),            // Reset Pin (low active, asynchronous and non-glitchy)
 | 
      
         | 226 |  |  |     .scan_enable       (1'b0),               // ASIC ONLY: Scan enable (active during scan shifting)
 | 
      
         | 227 |  |  |     .scan_mode         (1'b0),               // ASIC ONLY: Scan mode
 | 
      
         | 228 |  |  |     .wkup              (1'b0)                // ASIC ONLY: System Wake-up (asynchronous and non-glitchy)
 | 
      
         | 229 |  |  | );
 | 
      
         | 230 |  |  |  
 | 
      
         | 231 |  |  |  
 | 
      
         | 232 |  |  | //=============================================================================
 | 
      
         | 233 |  |  | // 3)  OPENMSP430 PERIPHERALS
 | 
      
         | 234 |  |  | //=============================================================================
 | 
      
         | 235 |  |  |  
 | 
      
         | 236 |  |  | //
 | 
      
         | 237 |  |  | // Digital I/O
 | 
      
         | 238 |  |  | //-------------------------------
 | 
      
         | 239 |  |  |  
 | 
      
         | 240 |  |  | omsp_gpio #(.P1_EN(1),
 | 
      
         | 241 |  |  |             .P2_EN(1),
 | 
      
         | 242 |  |  |             .P3_EN(0),
 | 
      
         | 243 |  |  |             .P4_EN(0),
 | 
      
         | 244 |  |  |             .P5_EN(0),
 | 
      
         | 245 |  |  |             .P6_EN(0)) gpio_0 (
 | 
      
         | 246 |  |  |  
 | 
      
         | 247 |  |  | // OUTPUTs
 | 
      
         | 248 |  |  |     .irq_port1    (irq_port1),             // Port 1 interrupt
 | 
      
         | 249 |  |  |     .irq_port2    (irq_port2),             // Port 2 interrupt
 | 
      
         | 250 |  |  |     .p1_dout      (p1_dout),               // Port 1 data output
 | 
      
         | 251 |  |  |     .p1_dout_en   (p1_dout_en),            // Port 1 data output enable
 | 
      
         | 252 |  |  |     .p1_sel       (p1_sel),                // Port 1 function select
 | 
      
         | 253 |  |  |     .p2_dout      (p2_dout),               // Port 2 data output
 | 
      
         | 254 |  |  |     .p2_dout_en   (p2_dout_en),            // Port 2 data output enable
 | 
      
         | 255 |  |  |     .p2_sel       (p2_sel),                // Port 2 function select
 | 
      
         | 256 |  |  |     .p3_dout      (),                      // Port 3 data output
 | 
      
         | 257 |  |  |     .p3_dout_en   (),                      // Port 3 data output enable
 | 
      
         | 258 |  |  |     .p3_sel       (),                      // Port 3 function select
 | 
      
         | 259 |  |  |     .p4_dout      (),                      // Port 4 data output
 | 
      
         | 260 |  |  |     .p4_dout_en   (),                      // Port 4 data output enable
 | 
      
         | 261 |  |  |     .p4_sel       (),                      // Port 4 function select
 | 
      
         | 262 |  |  |     .p5_dout      (),                      // Port 5 data output
 | 
      
         | 263 |  |  |     .p5_dout_en   (),                      // Port 5 data output enable
 | 
      
         | 264 |  |  |     .p5_sel       (),                      // Port 5 function select
 | 
      
         | 265 |  |  |     .p6_dout      (),                      // Port 6 data output
 | 
      
         | 266 |  |  |     .p6_dout_en   (),                      // Port 6 data output enable
 | 
      
         | 267 |  |  |     .p6_sel       (),                      // Port 6 function select
 | 
      
         | 268 |  |  |     .per_dout     (per_dout_gpio),         // Peripheral data output
 | 
      
         | 269 | 202 | olivier.gi |  
 | 
      
         | 270 | 157 | olivier.gi | // INPUTs
 | 
      
         | 271 |  |  |     .mclk         (mclk),                  // Main system clock
 | 
      
         | 272 |  |  |     .p1_din       (p1_din),                // Port 1 data input
 | 
      
         | 273 |  |  |     .p2_din       (p2_din),                // Port 2 data input
 | 
      
         | 274 |  |  |     .p3_din       (8'h00),                 // Port 3 data input
 | 
      
         | 275 |  |  |     .p4_din       (8'h00),                 // Port 4 data input
 | 
      
         | 276 |  |  |     .p5_din       (8'h00),                 // Port 5 data input
 | 
      
         | 277 |  |  |     .p6_din       (8'h00),                 // Port 6 data input
 | 
      
         | 278 |  |  |     .per_addr     (per_addr),              // Peripheral address
 | 
      
         | 279 |  |  |     .per_din      (per_din),               // Peripheral data input
 | 
      
         | 280 |  |  |     .per_en       (per_en),                // Peripheral enable (high active)
 | 
      
         | 281 |  |  |     .per_we       (per_we),                // Peripheral write enable (high active)
 | 
      
         | 282 |  |  |     .puc_rst      (puc_rst)                // Main system reset
 | 
      
         | 283 |  |  | );
 | 
      
         | 284 |  |  |  
 | 
      
         | 285 |  |  | // Assign LEDs
 | 
      
         | 286 | 167 | olivier.gi | assign  led         = p2_dout[1:0] & p2_dout_en[1:0];
 | 
      
         | 287 | 157 | olivier.gi |  
 | 
      
         | 288 |  |  | // Assign Switches
 | 
      
         | 289 |  |  | assign  p1_din[7:4] = 4'h0;
 | 
      
         | 290 |  |  | assign  p1_din[3:0] = switch;
 | 
      
         | 291 |  |  |  
 | 
      
         | 292 |  |  |  
 | 
      
         | 293 |  |  | //
 | 
      
         | 294 |  |  | // Timer A
 | 
      
         | 295 |  |  | //----------------------------------------------
 | 
      
         | 296 |  |  |  
 | 
      
         | 297 |  |  | omsp_timerA timerA_0 (
 | 
      
         | 298 |  |  |  
 | 
      
         | 299 |  |  | // OUTPUTs
 | 
      
         | 300 |  |  |     .irq_ta0      (irq_ta0),               // Timer A interrupt: TACCR0
 | 
      
         | 301 |  |  |     .irq_ta1      (irq_ta1),               // Timer A interrupt: TAIV, TACCR1, TACCR2
 | 
      
         | 302 |  |  |     .per_dout     (per_dout_tA),           // Peripheral data output
 | 
      
         | 303 |  |  |     .ta_out0      (),                      // Timer A output 0
 | 
      
         | 304 |  |  |     .ta_out0_en   (),                      // Timer A output 0 enable
 | 
      
         | 305 |  |  |     .ta_out1      (),                      // Timer A output 1
 | 
      
         | 306 |  |  |     .ta_out1_en   (),                      // Timer A output 1 enable
 | 
      
         | 307 |  |  |     .ta_out2      (),                      // Timer A output 2
 | 
      
         | 308 |  |  |     .ta_out2_en   (),                      // Timer A output 2 enable
 | 
      
         | 309 |  |  |  
 | 
      
         | 310 |  |  | // INPUTs
 | 
      
         | 311 |  |  |     .aclk_en      (aclk_en),               // ACLK enable (from CPU)
 | 
      
         | 312 |  |  |     .dbg_freeze   (dbg_freeze),            // Freeze Timer A counter
 | 
      
         | 313 |  |  |     .inclk        (1'b0),                  // INCLK external timer clock (SLOW)
 | 
      
         | 314 |  |  |     .irq_ta0_acc  (irq_acc[9]),            // Interrupt request TACCR0 accepted
 | 
      
         | 315 |  |  |     .mclk         (mclk),                  // Main system clock
 | 
      
         | 316 |  |  |     .per_addr     (per_addr),              // Peripheral address
 | 
      
         | 317 |  |  |     .per_din      (per_din),               // Peripheral data input
 | 
      
         | 318 |  |  |     .per_en       (per_en),                // Peripheral enable (high active)
 | 
      
         | 319 |  |  |     .per_we       (per_we),                // Peripheral write enable (high active)
 | 
      
         | 320 |  |  |     .puc_rst      (puc_rst),               // Main system reset
 | 
      
         | 321 |  |  |     .smclk_en     (smclk_en),              // SMCLK enable (from CPU)
 | 
      
         | 322 |  |  |     .ta_cci0a     (1'b0),                  // Timer A capture 0 input A
 | 
      
         | 323 |  |  |     .ta_cci0b     (1'b0),                  // Timer A capture 0 input B
 | 
      
         | 324 |  |  |     .ta_cci1a     (1'b0),                  // Timer A capture 1 input A
 | 
      
         | 325 |  |  |     .ta_cci1b     (1'b0),                  // Timer A capture 1 input B
 | 
      
         | 326 |  |  |     .ta_cci2a     (1'b0),                  // Timer A capture 2 input A
 | 
      
         | 327 |  |  |     .ta_cci2b     (1'b0),                  // Timer A capture 2 input B
 | 
      
         | 328 |  |  |     .taclk        (1'b0)                   // TACLK external timer clock (SLOW)
 | 
      
         | 329 |  |  | );
 | 
      
         | 330 |  |  |  
 | 
      
         | 331 |  |  |  
 | 
      
         | 332 |  |  | //
 | 
      
         | 333 |  |  | // Hardware UART
 | 
      
         | 334 |  |  | //----------------------------------------------
 | 
      
         | 335 |  |  |  
 | 
      
         | 336 |  |  | omsp_uart uart_0 (
 | 
      
         | 337 |  |  |  
 | 
      
         | 338 |  |  | // OUTPUTs
 | 
      
         | 339 |  |  |     .irq_uart_rx  (irq_uart_rx),           // UART receive interrupt
 | 
      
         | 340 |  |  |     .irq_uart_tx  (irq_uart_tx),           // UART transmit interrupt
 | 
      
         | 341 |  |  |     .per_dout     (per_dout_uart),         // Peripheral data output
 | 
      
         | 342 |  |  |     .uart_txd     (uart_txd),              // UART Data Transmit (TXD)
 | 
      
         | 343 |  |  |  
 | 
      
         | 344 |  |  | // INPUTs
 | 
      
         | 345 |  |  |     .mclk         (mclk),                  // Main system clock
 | 
      
         | 346 |  |  |     .per_addr     (per_addr),              // Peripheral address
 | 
      
         | 347 |  |  |     .per_din      (per_din),               // Peripheral data input
 | 
      
         | 348 |  |  |     .per_en       (per_en),                // Peripheral enable (high active)
 | 
      
         | 349 |  |  |     .per_we       (per_we),                // Peripheral write enable (high active)
 | 
      
         | 350 |  |  |     .puc_rst      (puc_rst),               // Main system reset
 | 
      
         | 351 |  |  |     .smclk_en     (smclk_en),              // SMCLK enable (from CPU)
 | 
      
         | 352 |  |  |     .uart_rxd     (uart_rxd)               // UART Data Receive (RXD)
 | 
      
         | 353 |  |  | );
 | 
      
         | 354 |  |  |  
 | 
      
         | 355 |  |  |  
 | 
      
         | 356 |  |  | //
 | 
      
         | 357 |  |  | // Combine peripheral data buses
 | 
      
         | 358 |  |  | //-------------------------------
 | 
      
         | 359 |  |  |  
 | 
      
         | 360 |  |  | assign per_dout = per_dout_gpio  |
 | 
      
         | 361 |  |  |                   per_dout_uart  |
 | 
      
         | 362 |  |  |                   per_dout_tA;
 | 
      
         | 363 |  |  |  
 | 
      
         | 364 |  |  | //
 | 
      
         | 365 |  |  | // Assign interrupts
 | 
      
         | 366 |  |  | //-------------------------------
 | 
      
         | 367 |  |  |  
 | 
      
         | 368 |  |  | assign nmi      =   1'b0;
 | 
      
         | 369 |  |  | assign irq_bus  =  {1'b0,         // Vector 13  (0xFFFA)
 | 
      
         | 370 |  |  |                     1'b0,         // Vector 12  (0xFFF8)
 | 
      
         | 371 |  |  |                     1'b0,         // Vector 11  (0xFFF6)
 | 
      
         | 372 |  |  |                     1'b0,         // Vector 10  (0xFFF4) - Watchdog -
 | 
      
         | 373 |  |  |                     irq_ta0,      // Vector  9  (0xFFF2)
 | 
      
         | 374 |  |  |                     irq_ta1,      // Vector  8  (0xFFF0)
 | 
      
         | 375 |  |  |                     irq_uart_rx,  // Vector  7  (0xFFEE)
 | 
      
         | 376 |  |  |                     irq_uart_tx,  // Vector  6  (0xFFEC)
 | 
      
         | 377 | 167 | olivier.gi |                     1'b0,         // Vector  5  (0xFFEA) - Reserved (Timer-A 0 from system 1)
 | 
      
         | 378 |  |  |                     1'b0,         // Vector  4  (0xFFE8) - Reserved (Timer-A 1 from system 1)
 | 
      
         | 379 | 157 | olivier.gi |                     irq_port2,    // Vector  3  (0xFFE6)
 | 
      
         | 380 |  |  |                     irq_port1,    // Vector  2  (0xFFE4)
 | 
      
         | 381 | 167 | olivier.gi |                     1'b0,         // Vector  1  (0xFFE2) - Reserved (Port 2 from system 1)
 | 
      
         | 382 |  |  |                     1'b0};        // Vector  0  (0xFFE0) - Reserved (Port 1 from system 1)
 | 
      
         | 383 | 157 | olivier.gi |  
 | 
      
         | 384 |  |  |  
 | 
      
         | 385 |  |  | endmodule // omsp_system_0
 |