Multiple Stateflow Charts Algebraic Loop Error

조회 수: 1 (최근 30일)
Aaron
Aaron 2015년 3월 12일
답변: Zack Peters 2015년 3월 13일
Is there a way to have two separate stateflow charts that interact without adding unit delays?
I am using the diagrams for HDL code generation and I do not want extra registers added by unit delays.
The state machines themselves are unrelated in the design and cannot be nested in the same stateflow chart.
I can attach a screenshot and a simple example if my question is unclear.
  댓글 수: 1
Aaron
Aaron 2015년 3월 12일
Here is a snapshot of the diagram, chart_1 and chart_2 are the same

댓글을 달려면 로그인하십시오.

답변 (1개)

Zack Peters
Zack Peters 2015년 3월 13일
There needs to be an order for the two chart calls. Let's assume for a second that chart_1 get's called first and is followed by a call to chart_2. If this is the case then the question is, what will chart_1 use as its input? The current value of the signal will be whatever chart_2 output on the previous time step - This is effectively a delay. If you want the input of chart_1 to be the output of chart_2 at the current time step then that's a bit impossible because chart_2 hasn't executed yet (reading values from the future?).
If you sit down and work out what the expected behavior of the system is then I think you'll find that a solution exists for you. Sometime I find that it helps to write some pseudo code of how you would expect for this to behave if it were written in a programming language (like MATLAB or C).
One idea to break the loop (other than the delays) is to implement a function call for each block and link them with a Feedback Latch block:
But again, the pseudo code will look something like:
step()
{
out1 = chart_1(in1);
in2 = out1;
out2 = chart_2(in2);
in1 = out2;
}

카테고리

Help CenterFile Exchange에서 Complex Logic에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by