首页 > > 详细

CSYE 7374讲解、讲解C++语言、辅导Embedded Systems、辅导C/C++程序设计 讲解数据库SQL|辅导R语言程序

CSYE 7374: IoT Embedded Systems
Assignment 2
Due on 2/5/20
1) Given the following C update function, what does the FSM look like ? Assume push and
pop are input pure signals and the return value of the function is a pure output signal called
output. In addition write down the description of this FSM as a 5-tuple.
typedef enum
{
STATE_A = 0,
STATE_B,
STATE_C,
STATE_D
} state_t;
typedef enum
{
PRESENT = 0,
ABSENT
} signal_t;
signal_t update(state_t *state, signal_t push, signal_t pop)
{
if (push == PRESENT && pop == ABSENT && *state < STATE_D)
{
if (*state == STATE_A)
{
*state = STATE_B;
}
else if (*state == STATE_B)
{
*state = STATE_C;
}
else if (*state == STATE_C)
{
*state = STATE_D;
}
return PRESENT;
}
else if (*state == STATE_D && push == ABSENT && pop == PRESENT)
{
*state = STATE_A;
return PRESENT;
}
return ABSENT;
}
2) Given:
1
Formally write down the description of this FSM as a 5-tuple:
(States,Inputs, Outputs, update, initialState)
Then write a C update that describes the FSM. Note that the function will have two outputs
and a single input. This is exactly the opposite to the FSM shown in the previous exercise
(two inputs and one output).
3) Given:
Is this true or false ? Give supporting argument:
“The output will eventually be a constant 0, or it will eventually be a constant 1. That
is, for some n ∈ N, after the n
th reaction, either the output will be 0 in every subsequent
reaction, or it will be 1 in every subsequent reaction.”
2

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!