联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2020-02-07 10:03

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


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp