sc_clock.cc (13194:9c6b495e650c) | sc_clock.cc (13200:06d1460c28ad) |
---|---|
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 --- 22 unchanged lines hidden (view full) --- 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/sc_clock.hh" | 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 --- 22 unchanged lines hidden (view full) --- 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/sc_clock.hh" |
39#include "systemc/ext/core/sc_main.hh" |
|
39#include "systemc/ext/core/sc_module.hh" // for sc_gen_unique_name 40 41namespace sc_gem5 42{ 43 44class ClockTick : public ScEvent 45{ 46 private: --- 102 unchanged lines hidden (view full) --- 149const sc_time &sc_clock::period() const { return _period; } 150double sc_clock::duty_cycle() const { return _dutyCycle; } 151const sc_time &sc_clock::start_time() const { return _startTime; } 152bool sc_clock::posedge_first() const { return _posedgeFirst; } 153 154const sc_time & 155sc_clock::time_stamp() 156{ | 40#include "systemc/ext/core/sc_module.hh" // for sc_gen_unique_name 41 42namespace sc_gem5 43{ 44 45class ClockTick : public ScEvent 46{ 47 private: --- 102 unchanged lines hidden (view full) --- 150const sc_time &sc_clock::period() const { return _period; } 151double sc_clock::duty_cycle() const { return _dutyCycle; } 152const sc_time &sc_clock::start_time() const { return _startTime; } 153bool sc_clock::posedge_first() const { return _posedgeFirst; } 154 155const sc_time & 156sc_clock::time_stamp() 157{ |
157 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 158 return *(const sc_time *)nullptr; | 158 return sc_time_stamp(); |
159} 160 161void 162sc_clock::before_end_of_elaboration() 163{ 164 _gem5UpEdge->createProcess(); 165 _gem5DownEdge->createProcess(); 166 if (_posedgeFirst) { 167 ::sc_gem5::scheduler.schedule(_gem5UpEdge, _startTime); 168 ::sc_gem5::scheduler.schedule(_gem5DownEdge, 169 _startTime + _period * _dutyCycle); 170 } else { 171 ::sc_gem5::scheduler.schedule(_gem5DownEdge, _startTime); 172 ::sc_gem5::scheduler.schedule(_gem5UpEdge, 173 _startTime + _period * (1.0 - _dutyCycle)); 174 } 175} 176 177} // namespace sc_core | 159} 160 161void 162sc_clock::before_end_of_elaboration() 163{ 164 _gem5UpEdge->createProcess(); 165 _gem5DownEdge->createProcess(); 166 if (_posedgeFirst) { 167 ::sc_gem5::scheduler.schedule(_gem5UpEdge, _startTime); 168 ::sc_gem5::scheduler.schedule(_gem5DownEdge, 169 _startTime + _period * _dutyCycle); 170 } else { 171 ::sc_gem5::scheduler.schedule(_gem5DownEdge, _startTime); 172 ::sc_gem5::scheduler.schedule(_gem5UpEdge, 173 _startTime + _period * (1.0 - _dutyCycle)); 174 } 175} 176 177} // namespace sc_core |