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#define __SYSTEMC_EXT_CHANNEL_SC_FIFO_HH__ 32 33#include <list> 34#include <string> 35 36#include "../core/sc_module.hh" // for sc_gen_unique_name 37#include "../core/sc_prim.hh" 38#include "../utils/sc_report_handler.hh" |
39#include "messages.hh" |
40#include "sc_fifo_in_if.hh" 41#include "sc_fifo_out_if.hh" 42 43namespace sc_core 44{ 45 46class sc_port_base; 47class sc_event; --- 17 unchanged lines hidden (view full) --- 65 virtual ~sc_fifo() {} 66 67 virtual void 68 register_port(sc_port_base &port, const char *iface_type_name) 69 { 70 std::string tn(iface_type_name); 71 if (tn == typeid(sc_fifo_in_if<T>).name() || 72 tn == typeid(sc_fifo_blocking_in_if<T>).name()) { |
73 if (_reader) 74 SC_REPORT_ERROR(SC_ID_MORE_THAN_ONE_FIFO_READER_, ""); |
75 _reader = &port; 76 } else if (tn == typeid(sc_fifo_out_if<T>).name() || 77 tn == typeid(sc_fifo_blocking_out_if<T>).name()) { |
78 if (_writer) 79 SC_REPORT_ERROR(SC_ID_MORE_THAN_ONE_FIFO_WRITER_, ""); |
80 _writer = &port; 81 } else { |
82 SC_REPORT_ERROR(SC_ID_BIND_IF_TO_PORT_, |
83 "sc_fifo<T> port not recognized"); 84 } 85 } 86 87 virtual void 88 read(T &t) 89 { 90 while (num_available() == 0) --- 141 unchanged lines hidden --- |