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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [bench/] [sysc/] [include/] [Or1200MonitorSC.h] - Blame information for rev 51

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

Line No. Rev Author Line
1 6 julius
// ----------------------------------------------------------------------------
2
 
3
// SystemC OpenRISC 1200 Monitor: definition
4
 
5
// Copyright (C) 2008  Embecosm Limited <info@embecosm.com>
6
 
7
// Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
8 44 julius
// Contributor Julius Baxter <jb@orsoc.se>
9 6 julius
 
10
// This file is part of the cycle accurate model of the OpenRISC 1000 based
11
// system-on-chip, ORPSoC, built using Verilator.
12
 
13
// This program is free software: you can redistribute it and/or modify it
14
// under the terms of the GNU Lesser General Public License as published by
15
// the Free Software Foundation, either version 3 of the License, or (at your
16
// option) any later version.
17
 
18
// This program is distributed in the hope that it will be useful, but WITHOUT
19
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
21
// License for more details.
22
 
23
// You should have received a copy of the GNU Lesser General Public License
24
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
25
 
26
// ----------------------------------------------------------------------------
27
 
28 51 julius
// $Id$
29 6 julius
 
30
#ifndef OR1200_MONITOR_SC__H
31
#define OR1200_MONITOR_SC__H
32
 
33 44 julius
#include <fstream>
34
#include <ctime>
35
 
36 6 julius
#include "systemc.h"
37
 
38
#include "OrpsocAccess.h"
39 51 julius
#include "MemoryLoad.h"
40 6 julius
 
41
//! Monitor for special l.nop instructions
42
 
43
//! This class is based on the or1200_monitor.v of the Verilog test bench. It
44
//! wakes up on each posedge clock to check for "special" l.nop instructions,
45
//! which need processing.
46
 
47
class Or1200MonitorSC
48
  : public sc_core::sc_module
49
{
50
public:
51
 
52
  // Constructor
53
  Or1200MonitorSC (sc_core::sc_module_name  name,
54 49 julius
                   OrpsocAccess            *_accessor,
55 51 julius
                   MemoryLoad              *_memoryload,
56 49 julius
                   int argc,
57
                   char *argv[]);
58 6 julius
 
59
  // Method to check instructions
60
  void  checkInstruction();
61
 
62 44 julius
  // Methods to setup and output state of processor to a file
63
  void displayState();
64
 
65 51 julius
  // Methods to generate the call and return list during execution
66
  void callLog();
67
 
68
  // Method to calculate performance of the sim
69 49 julius
  void perfSummary();
70
 
71 51 julius
  // Method to print out the command-line switches for this module's options  
72 49 julius
  void printSwitches();
73
 
74 51 julius
  // Method to print out the usage for each option
75 49 julius
  void printUsage();
76
 
77 6 julius
  // The ports
78
  sc_in<bool>   clk;
79
 
80
private:
81
 
82 51 julius
#define DEFAULT_PROF_FILE "sim.profile"
83
 
84 6 julius
  // Special NOP instructions
85
  static const uint32_t NOP_NOP    = 0x15000000;  //!< Normal nop instruction
86
  static const uint32_t NOP_EXIT   = 0x15000001;  //!< End of simulation
87
  static const uint32_t NOP_REPORT = 0x15000002;  //!< Simple report
88
  static const uint32_t NOP_PRINTF = 0x15000003;  //!< Simprintf instruction
89
  static const uint32_t NOP_PUTC   = 0x15000004;  //!< Putc instruction
90
 
91 44 julius
  // Variables for processor status output
92
  ofstream statusFile;
93 51 julius
  ofstream profileFile;
94 44 julius
  int logging_enabled;
95
  int exit_perf_summary_enabled;
96
  int insn_count;
97 51 julius
  long long cycle_count;
98 44 julius
 
99 51 julius
  //! Time measurement variable - for calculating performance of the sim
100 44 julius
  clock_t start;
101
 
102 6 julius
  //! The accessor for the Orpsoc instance
103
  OrpsocAccess *accessor;
104
 
105 51 julius
  //! The memory loading object
106
  MemoryLoad *memoryload;
107
 
108 6 julius
};      // Or1200MonitorSC ()
109
 
110
#endif  // OR1200_MONITOR_SC__H

powered by: WebSVN 2.1.0

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