Skip to content
This repository was archived by the owner on Jul 12, 2022. It is now read-only.

Distribution Blocks

Radhakrishna Sanka edited this page Nov 2, 2020 · 2 revisions

Distribution Blocks

Just like how Structural Descriptions are the the foundation for describing microfluidic architectures, Distribution blocks and statements consist of the types of statements that describe how connectivity within the flow layer is affected by the placement of valves. We refer to these interactions as distribution logic.

Distribution blocks consist of two type of statements, if else and case. By utilizing these syntax statement the user would be able to describe complex connectivity between the different flow/control variables.

Note:

Please keep in mind that the if else and case statements used here are slightly different from how you see them used in traditional programming languages. In programming languages (eg. Python), these syntaxes are used to describe control flow of program, for example when the computer sees the if <condition> statement in Python, the interpreter evaluates the <condition> and decides whether or not to execute that statement.

However, when a HDL compiler (such as LFR) sees the if <condition>, it understand that final design generated by the compiler needs support two different states (described by <condition>) and hence generate a final output that works for both with <condition> is True and False.

The distribute@ block

When defining a how the control signals interact with the flow layer we first create a distribute@ block in the main module body as shown in the example below:

module <unique_name>(<inputs>, <outputs>, <control_lines>);

...

...

...

    distribute@(<signal_list>)
    begin

        //Write the all the connectivity statements here

    end

...

...

...

endmodule

The <signal_list> shown here are the set of control variables on whose state, based on which the connectivity between the flow statements needs to change. This list of signals is called the sensitivity list and these signal are considered to be sensitive throughout the corresponding distribtue@ block.

Note: The LFR compiler will not allow you to describe/change the connectivity between the control signals in the `signal

Describing distribution logic

In order to describe how valves and the connectivity of the microfluidic networks, distribute@ blocks support two types of statements:

  1. if else
  2. case

Users can use either of these two syntaxes interchangeably to describe the connectivity of the devices during the different states of the device operation. However in practice it is recommended that the user use the if else statement only when specify 2-3 operational states and the case statement when more than 3 states are necessary to be described to help the readability of the code and help others easily comprehend how the device will function.

Syntax

The if else block is used as shown below:

...

distribute@(<sentivity_list>)
begin

if (<control_variable> == <value>)
    <output_variables> <= <input_variables>
else
    <output_variables> <= <input_variables>

end

...

In order to illustrate how the connectivity the flow variables flow_in, flow_out_option_1, flow_out_option_2 map to each other.

...

distribute@(signal_1)
begin

if (signal_1 == 1)
    flow_out_option_1 <= flow_in
else
    flow_out_option_2 <= flow_in

end

...

The user should note that in order to specify connectivity, one does not use the assign operator, instead we use the the distribute assign operator that can be described using <=.

The case block is as shown below:

...

distribute@(<sentivity_list>)
begin

case (<control_variable>)
begin
    <case1_value>: 
        <output_variables> <= <input_variables>
    <case2_value>:
        <output_variables> <= <input_variables>
    <case3_value>:
        <output_variables> <= <input_variables>
    <case4_value>:
        <output_variables> <= <input_variables>
    ...
    ...
    ...
end

end

...

Clone this wiki locally