Skip to content

Commit

Permalink
Merge branch 'master' into map_v2
Browse files Browse the repository at this point in the history
  • Loading branch information
furuame committed Nov 9, 2023
2 parents 0fc8a9b + 050a860 commit c80a284
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sparta/sparta/ports/Port.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ namespace sparta
return (bound_ports_.empty() == false);
}

/**
* \brief How many ports are bound to this port?
* \return The number of bound ports
*/
size_t getNumBoundPorts() const {
return bound_ports_.size();
}

/**
* \brief The direction of the port
* \return In or out
Expand Down
2 changes: 2 additions & 0 deletions sparta/sparta/utils/FastList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ namespace sparta::utils
*/
FastList(size_t size)
{
sparta_assert(size != 0,
"Cannot create a sparta::utils::FastList of size 0");
int node_idx = 0;
nodes_.reserve(size);
for(size_t i = 0; i < size; ++i) {
Expand Down
3 changes: 3 additions & 0 deletions sparta/test/FastList/FastList_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ std::ostream & operator<<(std::ostream & os, const MyObj & obj) {

void testFastList()
{

EXPECT_THROW(sparta::utils::FastList<MyObj> zero_fl(0));

sparta::utils::FastList<MyObj> fl(10);
std::cout << fl;

Expand Down
5 changes: 5 additions & 0 deletions sparta/test/Port/Port_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ int main ()
signal_out.bind(signal_in);
delay1_out_non_continuing.bind(delay1_in_non_continuing);

EXPECT_EQUAL(delay0_out.getNumBoundPorts(), 1);
EXPECT_EQUAL(delay0_in.getNumBoundPorts(), 1);
EXPECT_EQUAL(signal_out.getNumBoundPorts(), 1);
EXPECT_EQUAL(signal_in.getNumBoundPorts(), 1);

// Try some binding rules
sparta::SignalInPort signal_bind_in(&ps, "signal_bind_in");
sparta::SignalOutPort signal_bind_out(&ps, "signal_bind_out");
Expand Down

0 comments on commit c80a284

Please sign in to comment.