// ************************************************************************** //
//                                                                            //
//    eses                   eses                                             //
//   eses                     eses                                            //
//  eses    eseses  esesese    eses   Embedded Systems Group                  //
//  ese    ese  ese ese         ese                                           //
//  ese    eseseses eseseses    ese   Department of Computer Science          //
//  eses   eses          ese   eses                                           //
//   eses   eseses  eseseses  eses    University of Kaiserslautern            //
//    eses                   eses                                             //
//                                                                            //
// ************************************************************************** //
// The following implements an input driven copy node, i.e. it copies the     //
// values of the input stream to the output stream, whenever the the clock    //
// clk(x) of the input stream x triggers this action.                         //
// ************************************************************************** //

macro val(x) = x.0;
macro clk(x) = x.1;

module CpyIn(event(int* bool) ?x,!y) {
    loop {
        // ensure clock consistency
        clk(y) = clk(x);
        // produce output values
        val(y) = val(x);
        pause;
    }
}