3.7 Segment


Calling a segment

We talked about subcontracting a job to enable efficient parallel processing. However, there are repeatedly-used jobs of the subcontract type which are not conducive to improved parallelism if controlled independently. Such a job is described using a segment, or a "framework closed to a stage". A segment is similar to a software subroutine and is called by

call SegmentName (ReturnStateName);

A stage has a state register, which is large enough to identify any of its states and indicates the current state of the stage. A segment has a return state register, which is as large as the state register. When a segment is called, the return state value is in the return state register. When a segment is returned, the value in the return state register is set in the stage state register.

This mechanism makes it possible to call a segment while in a stage state and call another segment while in a segment state. In the case of a segment call with no return state specified, the value of the calling side's return state register is transferred to the called side's return state register when the segment calls another segment. This eliminates the machine cycle necessary for return (Figure 3.3).


<Fig 3.3> Segment call and return


Example of a segment description

This following shows how segments are described in SFL. The left-hand side of Figure 3.3 is described as:

stage X {
state_name st1, st2 ;
segment_name seg1, seg2 ;
first_state st1 ;
state st1 par {
..... ; (1)
call seg1 ( st2 ) ;
}
state st2 {
..... ; (2)
}
segment seg1 {
state_name st1, st2, st3 ;
first_state st1 ;
state st1 par {
..... ; (3)
call seg2 ( st2 ) ;
}
state st2 par {
..... ; (4)
goto st3 ;
}
state st3 par {
..... ; (5)
return ;
}
}
segment seg2 {
state_name st1, st2 ;
first_state st1 ;
state st1 par {
..... ; (6)
goto st2 ;
}
state st2 par {
..... ; (7)
return ;
}
}
}

Operations are executed in the order (1), (3), (6), (7), (4), (5) and (2).

The definition of the stage initial state (the line of "first_state") specifies the "state just after power-on reset", and the definition of the segment initial state (the line of "first_state") specifies "segment entrance (the first state)".


Back to the SFL (Structured Function Description Language) page

Back to Homepage