verilog HDLBits刷题[More Circuits]“Rule110”---Rule110

发布时间:2026/7/26 4:58:21
verilog HDLBits刷题[More Circuits]“Rule110”---Rule110 1、题目Rule 110 is a one-dimensional cellular automaton with interesting properties (such as being Turing-complete).There is a one-dimensional array of cells (on or off). At each time step, the state of each cell changes. In Rule 110, the next state of each cell depends only on itself and its two neighbours, according to the following table:LeftCenterRightCenters next state11101101101110000111010100110000(The name Rule 110 comes from reading the next state column: 01101110 is decimal 110.)In this circuit, create a 512-cell system (q[511:0]), and advance by one time step each clock cycle. The load input indicates the state of the system should be loaded with data[511:0]. Assume the boundaries (q[-1] and q[512]) are both zero (off).2、分析将所给列表画出真值表下一个q值满足式子next_q[i](q[i]^q[i-1])|(~q[i1]q[i-1])即ZB^C(非A)C。ABC分别为左中右Z为下一个q。3、代码module top_module( input clk, input load, input [511:0] data, output [511:0] q ); reg [511:0]next_q; always(*)begin next_q[0](q[0]^1b0)|(~q[1]1b0); next_q[511](q[511]^q[510])|(1b1q[510]); for(int i1;i510;i) next_q[i](q[i]^q[i-1])|(~q[i1]q[i-1]); end always(posedge clk)begin if(load) qdata; else qnext_q; end endmodule4、结果