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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [core/] [rtl/] [verilog/] [omsp_clock_module.v] - Diff between revs 202 and 205

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 202 Rev 205
Line 34... Line 34...
//
//
// *Author(s):
// *Author(s):
//              - Olivier Girard,    olgirard@gmail.com
//              - Olivier Girard,    olgirard@gmail.com
//
//
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// $Rev: 202 $
// $Rev: 205 $
// $LastChangedBy: olivier.girard $
// $LastChangedBy: olivier.girard $
// $LastChangedDate: 2015-07-01 23:13:32 +0200 (Wed, 01 Jul 2015) $
// $LastChangedDate: 2015-07-15 22:59:52 +0200 (Wed, 15 Jul 2015) $
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
`ifdef OMSP_NO_INCLUDE
`ifdef OMSP_NO_INCLUDE
`else
`else
`include "openMSP430_defines.v"
`include "openMSP430_defines.v"
`endif
`endif
Line 159... Line 159...
parameter [DEC_SZ-1:0] BCSCTL1_D   = (BASE_REG << BCSCTL1),
parameter [DEC_SZ-1:0] BCSCTL1_D   = (BASE_REG << BCSCTL1),
                       BCSCTL2_D   = (BASE_REG << BCSCTL2);
                       BCSCTL2_D   = (BASE_REG << BCSCTL2);
 
 
// Local wire declarations
// Local wire declarations
wire nodiv_mclk;
wire nodiv_mclk;
wire nodiv_mclk_n;
 
wire nodiv_smclk;
wire nodiv_smclk;
 
 
 
 
//============================================================================
//============================================================================
// 2)  REGISTER DECODER
// 2)  REGISTER DECODER
Line 416... Line 415...
   omsp_and_gate and_dco_dis4 (.y(dco_disable_by_cpu_en),  .a(~cpu_en_s),            .b(~mclk_enable));
   omsp_and_gate and_dco_dis4 (.y(dco_disable_by_cpu_en),  .a(~cpu_en_s),            .b(~mclk_enable));
   omsp_and_gate and_dco_dis5 (.y(dco_enable_nxt),         .a(~dco_disable_by_scg0), .b(~dco_disable_by_cpu_en));
   omsp_and_gate and_dco_dis5 (.y(dco_enable_nxt),         .a(~dco_disable_by_scg0), .b(~dco_disable_by_cpu_en));
 
 
   // Register to prevent glitch propagation
   // Register to prevent glitch propagation
   reg  dco_disable;
   reg  dco_disable;
   always @(posedge nodiv_mclk_n or posedge por)
   wire dco_wkup_set_scan_observe;
 
   always @(posedge nodiv_mclk or posedge por)
   if (por) dco_disable <= 1'b1;
   if (por) dco_disable <= 1'b1;
   else     dco_disable <= ~dco_enable_nxt;
   else     dco_disable <= ~dco_enable_nxt | dco_wkup_set_scan_observe;
 
 
 
   // Optional scan repair
 
   wire dco_clk_n;
 
   `ifdef SCAN_REPAIR_INV_CLOCKS
 
      omsp_scan_mux scan_mux_repair_dco_clk_n (
 
                                               .scan_mode    (scan_mode),
 
                                               .data_in_scan ( dco_clk),
 
                                               .data_in_func (~dco_clk),
 
                                               .data_out     ( dco_clk_n)
 
                                              );
 
   `else
 
      assign dco_clk_n = ~dco_clk;
 
   `endif
 
 
   // Note that a synchronizer is required if the MCLK mux is included
   // Note that a synchronizer is required if the MCLK mux is included
   wire dco_clk_n  = ~dco_clk;
 
   `ifdef MCLK_MUX
   `ifdef MCLK_MUX
      omsp_sync_cell sync_cell_dco_disable (
      omsp_sync_cell sync_cell_dco_disable (
         .data_out  (dco_enable),
         .data_out  (dco_enable),
         .data_in   (~dco_disable),
         .data_in   (~dco_disable),
         .clk       (dco_clk_n),
         .clk       (dco_clk_n),
         .rst       (por)
         .rst       (por)
      );
      );
   `else
   `else
      assign dco_enable     = ~dco_disable;
      // Optional scan repair
 
      wire nodiv_mclk_n;
 
      `ifdef SCAN_REPAIR_INV_CLOCKS
 
         omsp_scan_mux scan_mux_repair_nodiv_mclk_n (
 
                                                     .scan_mode    (scan_mode),
 
                                                     .data_in_scan ( nodiv_mclk),
 
                                                     .data_in_func (~nodiv_mclk),
 
                                                     .data_out     ( nodiv_mclk_n)
 
                                                    );
 
      `else
 
         assign nodiv_mclk_n = ~nodiv_mclk;
 
      `endif
 
 
 
      // Re-time DCO enable with MCLK falling edge
 
      reg  dco_enable;
 
      always @(posedge nodiv_mclk_n or posedge por)
 
      if (por) dco_enable <= 1'b0;
 
      else     dco_enable <= ~dco_disable;
   `endif
   `endif
 
 
   // The DCO oscillator will get an asynchronous wakeup if:
   // The DCO oscillator will get an asynchronous wakeup if:
   //      - the MCLK  generates a wakeup (only if the MCLK mux selects dco_clk)
   //      - the MCLK  generates a wakeup (only if the MCLK mux selects dco_clk)
   //      - if the DCO wants to be synchronously enabled (i.e dco_enable_nxt=1)
   //      - if the DCO wants to be synchronously enabled (i.e dco_enable_nxt=1)
Line 453... Line 482...
                                    .data_in_func (dco_wkup_set | por),
                                    .data_in_func (dco_wkup_set | por),
                                    .data_out     (dco_wkup_set_scan)
                                    .data_out     (dco_wkup_set_scan)
                                   );
                                   );
 
 
   // Scan MUX to increase coverage
   // Scan MUX to increase coverage
   wire dco_wkup_clear;
   omsp_scan_mux scan_mux_dco_wkup_observe (
   omsp_scan_mux scan_mux_dco_wkup_clear (
 
                                          .scan_mode    (scan_mode),
                                          .scan_mode    (scan_mode),
                                          .data_in_scan (dco_wkup_set),
                                          .data_in_scan (dco_wkup_set),
                                          .data_in_func (1'b1),
                                            .data_in_func (1'b0),
                                          .data_out     (dco_wkup_clear)
                                            .data_out     (dco_wkup_set_scan_observe)
                                         );
                                         );
 
 
   // The wakeup is asynchronously set, synchronously released
   // The wakeup is asynchronously set, synchronously released
   wire dco_wkup_n;
   wire dco_wkup_n;
   omsp_sync_cell sync_cell_dco_wkup (
   omsp_sync_cell sync_cell_dco_wkup (
       .data_out  (dco_wkup_n),
       .data_out  (dco_wkup_n),
       .data_in   (dco_wkup_clear),
       .data_in   (1'b1),
       .clk       (dco_clk_n),
       .clk       (dco_clk_n),
       .rst       (dco_wkup_set_scan)
       .rst       (dco_wkup_set_scan)
   );
   );
 
 
   omsp_and_gate and_dco_wkup (.y(dco_wkup), .a(~dco_wkup_n), .b(cpu_en));
   omsp_and_gate and_dco_wkup (.y(dco_wkup), .a(~dco_wkup_n), .b(cpu_en));
Line 510... Line 538...
   omsp_and_gate and_lfxt_dis4 (.y(lfxt_disable_by_cpu_en),  .a(~cpu_en_s),               .b(~mclk_enable));
   omsp_and_gate and_lfxt_dis4 (.y(lfxt_disable_by_cpu_en),  .a(~cpu_en_s),               .b(~mclk_enable));
   omsp_and_gate and_lfxt_dis5 (.y(lfxt_enable_nxt),         .a(~lfxt_disable_by_oscoff), .b(~lfxt_disable_by_cpu_en));
   omsp_and_gate and_lfxt_dis5 (.y(lfxt_enable_nxt),         .a(~lfxt_disable_by_oscoff), .b(~lfxt_disable_by_cpu_en));
 
 
   // Register to prevent glitch propagation
   // Register to prevent glitch propagation
   reg  lfxt_disable;
   reg  lfxt_disable;
   always @(posedge nodiv_mclk_n or posedge por)
   wire lfxt_wkup_set_scan_observe;
 
   always @(posedge nodiv_mclk or posedge por)
   if (por) lfxt_disable <= 1'b1;
   if (por) lfxt_disable <= 1'b1;
   else     lfxt_disable <= ~lfxt_enable_nxt;
   else     lfxt_disable <= ~lfxt_enable_nxt | lfxt_wkup_set_scan_observe;
 
 
 
   // Optional scan repair
 
   wire lfxt_clk_n;
 
   `ifdef SCAN_REPAIR_INV_CLOCKS
 
      omsp_scan_mux scan_mux_repair_lfxt_clk_n (
 
                                                  .scan_mode    (scan_mode),
 
                                                  .data_in_scan ( lfxt_clk),
 
                                                  .data_in_func (~lfxt_clk),
 
                                                  .data_out     ( lfxt_clk_n)
 
                                                 );
 
   `else
 
      assign lfxt_clk_n = ~lfxt_clk;
 
   `endif
 
 
   // Synchronize the OSCOFF control signal to the LFXT clock domain
   // Synchronize the OSCOFF control signal to the LFXT clock domain
   wire lfxt_clk_n  = ~lfxt_clk;
 
   omsp_sync_cell sync_cell_lfxt_disable (
   omsp_sync_cell sync_cell_lfxt_disable (
      .data_out  (lfxt_enable),
      .data_out  (lfxt_enable),
      .data_in   (~lfxt_disable),
      .data_in   (~lfxt_disable),
      .clk       (lfxt_clk_n),
      .clk       (lfxt_clk_n),
      .rst       (por)
      .rst       (por)
Line 543... Line 584...
                                     .data_in_func (lfxt_wkup_set | por),
                                     .data_in_func (lfxt_wkup_set | por),
                                     .data_out     (lfxt_wkup_set_scan)
                                     .data_out     (lfxt_wkup_set_scan)
                                    );
                                    );
 
 
   // Scan MUX to increase coverage
   // Scan MUX to increase coverage
   wire lfxt_wkup_clear;
   omsp_scan_mux scan_mux_lfxt_wkup_observe (
   omsp_scan_mux scan_mux_lfxt_wkup_clear (
 
                                           .scan_mode    (scan_mode),
                                           .scan_mode    (scan_mode),
                                           .data_in_scan (lfxt_wkup_set),
                                           .data_in_scan (lfxt_wkup_set),
                                           .data_in_func (1'b1),
                                             .data_in_func (1'b0),
                                           .data_out     (lfxt_wkup_clear)
                                             .data_out     (lfxt_wkup_set_scan_observe)
                                          );
                                          );
 
 
   // The wakeup is asynchronously set, synchronously released
   // The wakeup is asynchronously set, synchronously released
   wire lfxt_wkup_n;
   wire lfxt_wkup_n;
   omsp_sync_cell sync_cell_lfxt_wkup (
   omsp_sync_cell sync_cell_lfxt_wkup (
       .data_out  (lfxt_wkup_n),
       .data_out  (lfxt_wkup_n),
       .data_in   (lfxt_wkup_clear),
       .data_in   (1'b1),
       .clk       (lfxt_clk_n),
       .clk       (lfxt_clk_n),
       .rst       (lfxt_wkup_set_scan)
       .rst       (lfxt_wkup_set_scan)
   );
   );
 
 
   omsp_and_gate and_lfxt_wkup (.y(lfxt_wkup), .a(~lfxt_wkup_n), .b(cpu_en));
   omsp_and_gate and_lfxt_wkup (.y(lfxt_wkup), .a(~lfxt_wkup_n), .b(cpu_en));
Line 675... Line 715...
   .select_in (bcsctl2[`SELMx])
   .select_in (bcsctl2[`SELMx])
);
);
`else
`else
assign nodiv_mclk   =  dco_clk;
assign nodiv_mclk   =  dco_clk;
`endif
`endif
assign nodiv_mclk_n = ~nodiv_mclk;
 
 
 
 
 
// Wakeup synchronizer
// Wakeup synchronizer
//----------------------------
//----------------------------
wire cpuoff_and_mclk_dma_wkup_s;
wire cpuoff_and_mclk_dma_wkup_s;

powered by: WebSVN 2.1.0

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