sc_fifo.hh (13303:045f002c325c) sc_fifo.hh (13324:c8b709468e61)
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"
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"
39#include "sc_fifo_in_if.hh"
40#include "sc_fifo_out_if.hh"
41
42namespace sc_core
43{
44
45class sc_port_base;
46class sc_event;

--- 17 unchanged lines hidden (view full) ---

64 virtual ~sc_fifo() {}
65
66 virtual void
67 register_port(sc_port_base &port, const char *iface_type_name)
68 {
69 std::string tn(iface_type_name);
70 if (tn == typeid(sc_fifo_in_if<T>).name() ||
71 tn == typeid(sc_fifo_blocking_in_if<T>).name()) {
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()) {
72 if (_reader) {
73 SC_REPORT_ERROR(
74 "(E104) sc_fifo<T> cannot have more than one reader",
75 "");
76 }
73 if (_reader)
74 SC_REPORT_ERROR(SC_ID_MORE_THAN_ONE_FIFO_READER_, "");
77 _reader = &port;
78 } else if (tn == typeid(sc_fifo_out_if<T>).name() ||
79 tn == typeid(sc_fifo_blocking_out_if<T>).name()) {
75 _reader = &port;
76 } else if (tn == typeid(sc_fifo_out_if<T>).name() ||
77 tn == typeid(sc_fifo_blocking_out_if<T>).name()) {
80 if (_writer) {
81 SC_REPORT_ERROR(
82 "(E105) sc_fifo<T> cannot have more than one writer",
83 "");
84 }
78 if (_writer)
79 SC_REPORT_ERROR(SC_ID_MORE_THAN_ONE_FIFO_WRITER_, "");
85 _writer = &port;
86 } else {
80 _writer = &port;
81 } else {
87 SC_REPORT_ERROR("(E107) bind interface to port failed",
82 SC_REPORT_ERROR(SC_ID_BIND_IF_TO_PORT_,
88 "sc_fifo<T> port not recognized");
89 }
90 }
91
92 virtual void
93 read(T &t)
94 {
95 while (num_available() == 0)

--- 141 unchanged lines hidden ---
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 ---