degate  0.1.2
Functions
VerilogTBCodeTemplateGenerator.cc File Reference
#include <VerilogTBCodeTemplateGenerator.h>
#include <boost/format.hpp>
#include <boost/foreach.hpp>
#include <boost/algorithm/string/join.hpp>

Go to the source code of this file.

Functions

bool increment (std::vector< int > &assignment, size_t pos=0)
 Recursive implementation of an increment function.

Function Documentation

bool increment ( std::vector< int > &  assignment,
size_t  pos = 0 
)

Recursive implementation of an increment function.

Starts with MSB and increments until position right to LSB is reached.

Returns:
Returns false, if there is nothing to do.

Definition at line 150 of file VerilogTBCodeTemplateGenerator.cc.

Referenced by degate::VerilogTBCodeTemplateGenerator::generate_all_assignments().

                                                            {
  if(assignment.size() == 0) return false;

  // toggle lsb
  if(assignment[pos] == 0) {
    assignment[pos] = 1;
    return true;
  }
  else {
    assignment[pos] = 0;
    if(pos + 1 == assignment.size()) return false;
    else return increment(assignment, pos + 1);
  }
      
}

Here is the caller graph for this function: