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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [bench/] [sysc/] [src/] [ResetSC.cpp] - Diff between revs 6 and 462

Only display areas with differences | Details | Blame | View Log

Rev 6 Rev 462
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
 
 
// SystemC reset signal generator
// SystemC reset signal generator
 
 
// Copyright (C) 2008  Embecosm Limited <info@embecosm.com>
// Copyright (C) 2008  Embecosm Limited <info@embecosm.com>
 
 
// Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
// Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
 
 
// This file is part of the cycle accurate model of the OpenRISC 1000 based
// This file is part of the cycle accurate model of the OpenRISC 1000 based
// system-on-chip, ORPSoC, built using Verilator.
// system-on-chip, ORPSoC, built using Verilator.
 
 
// This program is free software: you can redistribute it and/or modify it
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by
// under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or (at your
// the Free Software Foundation, either version 3 of the License, or (at your
// option) any later version.
// option) any later version.
 
 
// This program is distributed in the hope that it will be useful, but WITHOUT
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
// License for more details.
// License for more details.
 
 
// You should have received a copy of the GNU Lesser General Public License
// You should have received a copy of the GNU Lesser General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
 
 
// $Id: ResetSC.cpp 286 2009-02-03 11:19:30Z jeremy $
// $Id: ResetSC.cpp 286 2009-02-03 11:19:30Z jeremy $
 
 
#include "ResetSC.h"
#include "ResetSC.h"
 
 
SC_HAS_PROCESS( ResetSC );
SC_HAS_PROCESS(ResetSC);
 
 
//! Constructor for the reset generator
//! Constructor for the reset generator
 
 
//! @param name          Name of this module, passed to the parent
//! @param name          Name of this module, passed to the parent
//!                      constructor.
//!                      constructor.
//! @param resetCounter  Number of cycles of reset to provide.
//! @param resetCounter  Number of cycles of reset to provide.
 
 
ResetSC::ResetSC (sc_core::sc_module_name  name,
ResetSC::ResetSC(sc_core::sc_module_name name, int _resetCounter):
                  int                      _resetCounter) :
sc_module(name), resetCounter(_resetCounter)
  sc_module (name),
 
  resetCounter (_resetCounter)
 
{
{
  SC_METHOD (driveReset);
        SC_METHOD(driveReset);
  sensitive << clk.neg();
        sensitive << clk.neg();
 
 
}       // ResetSC ()
}                               // ResetSC ()
 
 
 
 
//! Method to drive the reset port (active low). We will be called as an
//! Method to drive the reset port (active low). We will be called as an
//! initialization, which can be used to drive the reset low.
//! initialization, which can be used to drive the reset low.
void
void ResetSC::driveReset()
ResetSC::driveReset()
 
{
 
  if (resetCounter > 0)
 
    {
    {
 
        if (resetCounter > 0) {
      rst  = 1;
      rst  = 1;
      rstn = 0;
                rstn = 0;
      resetCounter--;
      resetCounter--;
    }
        } else {
  else
 
    {
 
      rst  = 0;
      rst  = 0;
      rstn = 1;
                rstn = 1;
    }
        }
}       // driveReset()
}                               // driveReset()
 
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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