hdlbits_Exams/ece241_2014_q5b
【hdlbits_Exams/ece241_2014_q5b】https://hdlbits.01xz.net/wiki/Exams/ece241_2014_q5b
module top_module (
input clk,
input areset,
input x,
output z
);
parameter A=0,B=1;
reg state, next;
always @(*)
begin
case(state)
A: next = x?B:A;
B: next = x?B:B;
endcase
endalways@(posedge clk or posedge areset)
begin
if (areset)
state <= A;
else
state <= next;
endassign z=(state==B & x==0)|(state==A & x==1);
endmodule
推荐阅读
- ACM|codeforces 732-D. Exams (二分)
- HDLBits Day12 count clock 做一个钟表
- HDLbits答案更新系列23(5|HDLbits答案更新系列23(5 Verification: Reading Simulation)
- HDLbits答案更新系列19(3.3|HDLbits答案更新系列19(3.3 Building Larger Circuits 3.3.1 Counter with period 1000等)
- HDLbits答案更新系列10(3.2|HDLbits答案更新系列10(3.2 Sequential Logic 3.2.4 More Circuits)
- HDLbits答案更新系列13(3.2.5|HDLbits答案更新系列13(3.2.5 Finite State Machines 3.2.5.10 Lemmings 1等)
- HDLbits答案更新系列9(3.2|HDLbits答案更新系列9(3.2 Sequential Logic 3.2.3 Shift Registers)
- HDLbits答案更新系列8(3.2|HDLbits答案更新系列8(3.2 Sequential Logic 3.2.2 Counters)
- HDLBits记录(二)
- HDLBits记录(三)