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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [orpsocv2/] [bench/] [sysc/] [src/] [ResetSC.cpp] - Blame information for rev 307

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 julius
// ----------------------------------------------------------------------------
2
 
3
// SystemC reset signal generator
4
 
5
// Copyright (C) 2008  Embecosm Limited <info@embecosm.com>
6
 
7
// Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
8
 
9
// This file is part of the cycle accurate model of the OpenRISC 1000 based
10
// system-on-chip, ORPSoC, built using Verilator.
11
 
12
// This program is free software: you can redistribute it and/or modify it
13
// under the terms of the GNU Lesser General Public License as published by
14
// the Free Software Foundation, either version 3 of the License, or (at your
15
// option) any later version.
16
 
17
// This program is distributed in the hope that it will be useful, but WITHOUT
18
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
20
// License for more details.
21
 
22
// You should have received a copy of the GNU Lesser General Public License
23
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
24
 
25
// ----------------------------------------------------------------------------
26
 
27
// $Id: ResetSC.cpp 286 2009-02-03 11:19:30Z jeremy $
28
 
29
#include "ResetSC.h"
30
 
31
SC_HAS_PROCESS( ResetSC );
32
 
33
//! Constructor for the reset generator
34
 
35
//! @param name          Name of this module, passed to the parent
36
//!                      constructor.
37
//! @param resetCounter  Number of cycles of reset to provide.
38
 
39
ResetSC::ResetSC (sc_core::sc_module_name  name,
40
                  int                      _resetCounter) :
41
  sc_module (name),
42
  resetCounter (_resetCounter)
43
{
44
  SC_METHOD (driveReset);
45
  sensitive << clk.neg();
46
 
47
}       // ResetSC ()
48
 
49
 
50
//! Method to drive the reset port (active low). We will be called as an
51
//! initialization, which can be used to drive the reset low.
52
void
53
ResetSC::driveReset()
54
{
55
  if (resetCounter > 0)
56
    {
57
      rst  = 1;
58
      rstn = 0;
59
      resetCounter--;
60
    }
61
  else
62
    {
63
      rst  = 0;
64
      rstn = 1;
65
    }
66
}       // driveReset()
67
 

powered by: WebSVN 2.1.0

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