1/* 2 * Copyright 2018 Google, Inc. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are 6 * met: redistributions of source code must retain the above copyright 7 * notice, this list of conditions and the following disclaimer; 8 * redistributions in binary form must reproduce the above copyright --- 21 unchanged lines hidden (view full) --- 30#include "base/logging.hh" 31#include "base/types.hh" 32#include "sim/core.hh" 33#include "sim/eventq.hh" 34#include "systemc/core/kernel.hh" 35#include "systemc/core/process_types.hh" 36#include "systemc/core/sched_event.hh" 37#include "systemc/core/scheduler.hh" |
38#include "systemc/ext/channel/messages.hh" |
39#include "systemc/ext/channel/sc_clock.hh" 40#include "systemc/ext/core/sc_main.hh" 41#include "systemc/ext/core/sc_module.hh" // for sc_gen_unique_name 42#include "systemc/ext/utils/sc_report_handler.hh" 43 44namespace sc_gem5 45{ 46 --- 62 unchanged lines hidden (view full) --- 109 sc_interface(), sc_signal<bool>(name, posedge_first ? false : true), 110 _period(period), _dutyCycle(duty_cycle), _startTime(start_time), 111 _posedgeFirst(posedge_first) 112{ 113 if (period == SC_ZERO_TIME) { 114 std::string msg = 115 "increase the period: clock '" + 116 std::string(name) + "'"; |
117 SC_REPORT_ERROR(SC_ID_CLOCK_PERIOD_ZERO_, msg.c_str()); |
118 } 119 120 if (duty_cycle * period == SC_ZERO_TIME) { 121 std::string msg = 122 "increase the period or increase the duty cycle: clock '" + 123 std::string(name) + "'"; |
124 SC_REPORT_ERROR(SC_ID_CLOCK_HIGH_TIME_ZERO_, msg.c_str()); |
125 } 126 127 if (duty_cycle * period == period) { 128 std::string msg = 129 "increase the period or decrease the duty cycle: clock '" + 130 std::string(name) + "'"; |
131 SC_REPORT_ERROR(SC_ID_CLOCK_LOW_TIME_ZERO_, msg.c_str()); |
132 } 133 134 _gem5UpEdge = new ::sc_gem5::ClockTick(this, true, period); 135 _gem5DownEdge = new ::sc_gem5::ClockTick(this, false, period); 136} 137 138sc_clock::sc_clock(const char *name, double period_v, sc_time_unit period_tu, 139 double duty_cycle) : --- 61 unchanged lines hidden --- |