sc_clock.cc (13200:06d1460c28ad) | sc_clock.cc (13297:bd7203a206f6) |
---|---|
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 --- 24 unchanged lines hidden (view full) --- 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/sc_clock.hh" 39#include "systemc/ext/core/sc_main.hh" 40#include "systemc/ext/core/sc_module.hh" // for sc_gen_unique_name | 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 --- 24 unchanged lines hidden (view full) --- 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/sc_clock.hh" 39#include "systemc/ext/core/sc_main.hh" 40#include "systemc/ext/core/sc_module.hh" // for sc_gen_unique_name |
41#include "systemc/ext/utils/sc_report_handler.hh" |
|
41 42namespace sc_gem5 43{ 44 45class ClockTick : public ScEvent 46{ 47 private: 48 ::sc_core::sc_clock *clock; --- 54 unchanged lines hidden (view full) --- 103 104sc_clock::sc_clock(const char *name, const sc_time &period, 105 double duty_cycle, const sc_time &start_time, 106 bool posedge_first) : 107 sc_interface(), sc_signal<bool>(name, posedge_first ? false : true), 108 _period(period), _dutyCycle(duty_cycle), _startTime(start_time), 109 _posedgeFirst(posedge_first) 110{ | 42 43namespace sc_gem5 44{ 45 46class ClockTick : public ScEvent 47{ 48 private: 49 ::sc_core::sc_clock *clock; --- 54 unchanged lines hidden (view full) --- 104 105sc_clock::sc_clock(const char *name, const sc_time &period, 106 double duty_cycle, const sc_time &start_time, 107 bool posedge_first) : 108 sc_interface(), sc_signal<bool>(name, posedge_first ? false : true), 109 _period(period), _dutyCycle(duty_cycle), _startTime(start_time), 110 _posedgeFirst(posedge_first) 111{ |
112 if (period == SC_ZERO_TIME) { 113 std::string msg = 114 "increase the period: clock '" + 115 std::string(name) + "'"; 116 SC_REPORT_ERROR("(E101) sc_clock period is zero", msg.c_str()); 117 } 118 119 if (duty_cycle * period == SC_ZERO_TIME) { 120 std::string msg = 121 "increase the period or increase the duty cycle: clock '" + 122 std::string(name) + "'"; 123 SC_REPORT_ERROR("(E102) sc_clock high time is zero", msg.c_str()); 124 } 125 126 if (duty_cycle * period == period) { 127 std::string msg = 128 "increase the period or decrease the duty cycle: clock '" + 129 std::string(name) + "'"; 130 SC_REPORT_ERROR("(E103) sc_clock low time is zero", msg.c_str()); 131 } 132 |
|
111 _gem5UpEdge = new ::sc_gem5::ClockTick(this, true, period); 112 _gem5DownEdge = new ::sc_gem5::ClockTick(this, false, period); 113} 114 115sc_clock::sc_clock(const char *name, double period_v, sc_time_unit period_tu, 116 double duty_cycle) : 117 sc_clock(name, sc_time(period_v, period_tu), duty_cycle, SC_ZERO_TIME, 118 true) --- 59 unchanged lines hidden --- | 133 _gem5UpEdge = new ::sc_gem5::ClockTick(this, true, period); 134 _gem5DownEdge = new ::sc_gem5::ClockTick(this, false, period); 135} 136 137sc_clock::sc_clock(const char *name, double period_v, sc_time_unit period_tu, 138 double duty_cycle) : 139 sc_clock(name, sc_time(period_v, period_tu), duty_cycle, SC_ZERO_TIME, 140 true) --- 59 unchanged lines hidden --- |