网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
定义状态机当前状态为state ,次态为next _state; 输入a,输出b, 则下列为Mealy状态机的写法是:
A.always@(posedge clk) case (state ) 0:next_state<=1; 1:next_state<=x;#B.always@(posedge clk) case (state ) 0: if(a==0)next_state<=1; else next_state<=x; 1:next_state<=x;#C.always@(posedge clk) case (state ) 0: if(state==0)next_state<=1; else next_state<=x; 1:next_state<=x;#D.以上都不对参考答案和解析
MACP
更多 “定义状态机当前状态为state ,次态为next _state; 输入a,输出b, 则下列为Mealy状态机的写法是:A.always@(posedge clk) case (state ) 0:next_state<=1; 1:next_state<=x;#B.always@(posedge clk) case (state ) 0: if(a==0)next_state<=1; else next_state<=x; 1:next_state<=x;#C.always@(posedge clk) case (state ) 0: if(state==0)next_state<=1; else next_state<=x; 1:next_state<=x;#D.以上都不对” 相关考题
考题
下图是一个简单的ATM机中描述验证信用卡PIN活动的有限状态机。其中包含五个用“”表示的状态和八个用“→”表示的转移。转移上的标签所遵循的是:横线上方是引起转移的事件,横线下方是与该转移相关联的行动。该有限状态机允许储户有三次输入PIN的机会,如果三次都输入错误,则停止交易退卡。请给出与此有限状态机等价的控制流图;
考题
阅读以下说明和C++代码。【说明】传输门是传输系统中的重要装置。传输门具有Open(打开)、Closed(关闭)、Opening (正在打开)、StayOpen(保持打开)和Closing(正在关闭)五种状态。触发传输门状态转换的事件有click、complete和timeout三种。事件与其相应的状态转换如下图所示。下面的C++代码1与C++代码2分别用两种不同的设计思路对传输门进行状态模拟,请填补代码中的空缺。【C++代码1】const int CLOSED=1; const int PENING=2;const int PEN=3; const int CLOSING=4;const int STAYOPEN=5; //定义状态变量,用不同整数表示不同状态class Door {Private:int state; //传输门当前状态void setState(int state){ this->state=state;} //设置当前状态public:Door():state(CLOSED){};void getState(){ //根据当前状态输出相应的字符串switch(state){case OPENING: cout<<"OPENING"<<endl; break;case CLOSED: cout<<"CLOSED"<<endl; break;case OPEN: cout<<"OPEN"<<endl; break;case CLOSING: cout<<"CLOSING"<<endl; break;case STAYOPEN:cout<<"STAYOPEN"<<endl; break;}};void click() { //发生click事件时进行状态转换if ((1)) setState(OPENING);else if ((2)) setState(CLOSING);else if ((3)) setState(STAYOPEN);}void timeout(){ //发生timeout事件时进行状态转换if (state == OPEN) setState(CLOSING);}void complete(){ //发生complete事件时进行状态转换if (state == OPENING) setState(OPEN);else if (state == CLOSING) setState(CLOSED);}};int main(){Door aDoor;aDoor.getState();aDoor.click(); aDoor.getState();aDoor.complete();aDoor.getState(); aDoor.click();aDoor.getState();aDoor.click(); aDoor.getState(); return 0;}【C++代码2】class Door {public:DoorState *CLOSED,*OPENING,*OPEN,*CLOSING,*STAYOPEN,*state;Door();virtual~Door(){……//释放申请的内存,此处代码省略);void setState(DoorState *state) { this->state = state;}void getState(){//此处代码省略,本方法输出状态字符串,//例如,当前状态为CLOSED时,输出字符串为“CLOSED”};void click();void timeout();void complete();};Door::Door(){CLOSED = new DoorClosed(this); OPENING = new DoorOpening(this);PEN = new DoorOpen(this); CLOSING = new DoorClosing(this);STAYOPEN = new DoorStayOpen(this);state = CLOSED;}void Door :: click() {(4);)void Door :: timeout() {(5);)void Door :: complete() {(6);}class DoorState//定义一个抽象的状态,它是所有状态类的基类{protected:Door *door;public:DoorState(Door *door) {this->door = door;}virtual~DoorState(void);virtual void click() {}virtual void complete(
考题
用FSM实现101101的序列检测模块。(南山之桥)a为输入端,b为输出端,如果a连续输入为1101则b输出为1,否则为0。例如a: 0001100110110100100110b: 0000000000100100000000请画出state machine;请用RTL描述其state machine。(未知)
考题
下面哪些ISOF状态迁移是可能得()
A.邻居状态机(Down—Init)B.邻居状态机(Down—2-Way)C.邻居状态机(Loading—Full)D.邻居状态机(Init—2-Way)
考题
两台运行OSPF协议的路由器通过点对点的链路相连,在两者链路状态数据库达到同步(邻居状态机为FULL)之后的2个小时之内,在两台路由器之间的链路上,一定有下列的那些报文在传递?()A、HELLO报文(Hello Packet)B、DD报文(Database Description Packet)C、LSR报文(Link State Request Packet)D、LSU报文(Link State Update Packet)E、LSAck报文(Link State Acknowledgmen Packet)
考题
两台运行OSPF协议的路由器通过点对点的链路相连,在两者链路状态数据库达到同步(邻居状态机为FULL)之后的2个小时之内,在两台路由器之间的链路上,一定有下列的那些报文在传递?()A、HELLO报文(Hello Packet)B、DD报文(Database Description Packet)C、LSR报文(Link State Request Packet)D、LSAck报文(Link State Acknowledgmen Packet)
考题
状态机VI架构的缺点是()A、状态机VI只能按顺序执行状态B、如果两个事件同时发生,只处理第一个事件,第二个事件将丢失C、通用架构转换为状态机架构后,程序框图将显著增大D、状态机不能采集数据或使用DAQ函数
考题
多选题下面哪些OSPF状态迁移是正确的?()A邻居状态机,Loading状态下发生LoadingDone事件后的结果是状态迁移到FullB邻居状态机,Exstart状态下发生NegotiationDone时间后的结果是状态迁移到FullC邻居状态机,Exchange状态下发生ExchangeDone时间后的结果是状态迁移到ExstartD邻居状态机,Exchange状态下发生ExchangeDone事件后的结果是状态迁移到Loading
考题
单选题状态机VI架构的缺点是()A
状态机VI只能按顺序执行状态B
如果两个事件同时发生,只处理第一个事件,第二个事件将丢失C
通用架构转换为状态机架构后,程序框图将显著增大D
状态机不能采集数据或使用DAQ函数
考题
判断题Moore状态机输出只是状态机当前状态的函数,Mealy状态机输出为有限状态机当前值和输入值的函数A
对B
错
热门标签
最新试卷