[HDLBits] Rule90

Rule 90 is a one-dimensional cellular automaton with interesting properties.

The rules are simple. There is a one-dimensional array of cells (on or off). At each time step, the next state of each cell is the XOR of the cell's two current neighbours. A more verbose way of expressing this rule is the following table, where a cell's next state is a function of itself and its two neighbours:

Left Center Right Center's next state
1 1 1 0
1 1 0 1
1 0 1 0
1 0 0 1
0 1 1 1
0 1 0 0
0 0 1 1
0 0 0 0

(The name "Rule 90" comes from reading the "next state" column: 01011010 is decimal 90.)

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).

复制代码
module top_module(
    input clk,
    input load,
    input [511:0] data,
    output [511:0] q ); 
    always@(posedge clk) begin
        if(load)
            q<=data;
        else
            q<={1'b0,q[511:1]}^{q[510:0],1'b0};
        //verilog最好的地方就是支持整个数组批量运算
    end
endmodule

verilog真舒服

相关推荐
Aaron158817 分钟前
基于RFSOC的数字射频存储技术应用分析
c语言·人工智能·驱动开发·算法·fpga开发·硬件工程·信号处理
碎碎思9 小时前
当 FPGA 遇见怀旧计算:486 与 Atari ST 的硬件级重生
fpga开发
数字芯片实验室10 小时前
怎么定义芯片上的异步时钟?
单片机·嵌入式硬件·fpga开发
unicrom_深圳市由你创科技12 小时前
基于ARM+DSP+FPGA异构计算架构的高速ADC采集卡定制方案
arm开发·fpga开发
北京青翼科技13 小时前
高速采集卡丨AD 采集丨 多通道数据采集卡丨高速数据采集系统丨青翼科技FMC 子卡
图像处理·人工智能·fpga开发·信号处理·智能硬件
北京青翼科技1 天前
PCIe接口-高速模拟采集—高性能计算卡-青翼科技高品质军工级数据采集板-打造专业工业核心板
图像处理·人工智能·fpga开发·信号处理·智能硬件
dadaobusi1 天前
verilog重音符号
fpga开发
s09071361 天前
Xilinx FPGA ISERDES 使用详细介绍
fpga开发·xilinx·ddr·iserdes
虹科智能自动化2 天前
虹科分享 | SocTek IP Cores:FPGA高端网络与时间同步解决方案
fpga开发·ip核·tsn时间敏感网络
秋风战士2 天前
无线通信算法之340:信道均衡除法定标讨论
算法·fpga开发·信息与通信