Jump to content
rsmitra09

data-flow vs control-flow in PSS

Recommended Posts

PSS allows both control-flow and data-flow dependencies. Control flow is among statements within an activity, whereas data-flow permits inferencing which additional actions to be scheduled and when. However, the semantics for mixing these 2 kinds of flow is not specified in the manual. For example, take the code given below, which has 3 actions defined in it:

  • read3_write3: User explicitly calls read and write inside a loop, and inferencing is not needed.
  • read1_write3: User explicitly calls read outside the loop, and calls write inside the loop, and again inferencing is not needed.
  • read_write_implicit: Here, the semantics are not clear. The loop only calls write, which requires a data and hence read will be scheduled before it. Should the read be scheduled inside the loop or outside it? ie, is read_write_implicit equivalent to read3_write3 or read1_write3?

An additional question related to this code is: the bind command is used to bind (input or output) ports of different actions. But in our code, the data (eg read3_write3::i) is read from one action and written to another action, so it is neither input nor output. Either an additional specifier 'inout' should be introduced, or the bind keyword should allow ports to bind to non-ports also. In the example, I have assumed the 2nd alternative.

component IO {
    action READ {
        output int i; 
        exec body C = """scanf("%d\n", &{{i}});""";
    }
    action WRITE {
        input int i; 
        exec body C = """printf("value %d\n", {{i}});""";
    }
}
component pss_top {
    IO s;
    action read3_write3 {
        int count;
        int i;
        activity {
            bind s.READ.i i;
            bind i s.WRITE.i;
            count = 0;
            repeat while(count<=3) {
                s.READ;
                s.WRITE;
                count = count + 1;
            }
        }
    };
    action read1_write3 {
        int count;
        int i;
        activity {
            bind s.READ.i i;
            bind i s.WRITE.i;
            count = 0;
            s.READ;
            repeat while(count<=3) {
                s.WRITE;
                count = count + 1;
            }
        }
    };
    action read_write_implicit {
        int count;
        int i;
        activity {
            bind i s.WRITE.i;
            count = 0;
            repeat while(count<=3) {
                s.WRITE;
                count = count + 1;
            }
        }
    };
    action top {
        activity {
            read_write_implicit;
            read1_write3;
            read3_write3;
        }
    };
}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×