[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真舒服

相关推荐
Terasic友晶科技3 小时前
DE25-Nano开发板在Programmer的 Auto Detect 下检测出来的器件和友晶官方提供的工程里器件不一样有没有关系?
fpga开发·auto detect·de25-nano·jtag id
ShiMetaPi7 小时前
GM-3568JHF丨ARM+FPGA异构开发板应用开发教程:04 MIPI屏幕检测案例
arm开发·fpga开发·rk3568
最遥远的瞬间9 小时前
四、呼吸灯实战
fpga开发
FPGA小c鸡9 小时前
FPGA高速收发器GTH完全指南:从零基础到10Gbps高速设计实战
fpga开发
乌恩大侠9 小时前
【AI-RAN 调研】软银株式会社的 “AITRAS” 基于 Arm 架构的 NVIDIA 平台 实现 集中式与分布式 AI-RAN 架构
人工智能·分布式·fpga开发·架构·usrp·mimo
Saniffer_SH1 天前
【高清视频】笔记本电脑出现蓝屏、死机、慢、不稳定是这样连接分析M.2 SSD的
运维·服务器·网络·人工智能·驱动开发·嵌入式硬件·fpga开发
Z22ZHaoGGGG1 天前
Verilog实现对采样信号有效值(RMS)的计算
fpga开发
简简单单做算法1 天前
基于FPGA的图像形态学腐蚀处理Verilog开发与开发板硬件测试
fpga开发·腐蚀·形态学处理·硬件调试
hong_fpgaer1 天前
XILINX ZYNQ FPGA PS端DMA握手流程
fpga开发·vivado
北城笑笑1 天前
FPGA 50 ,Xilinx Vivado 2020 版本安装流程,以及常见问题解析,附中文翻译( Vivado 2020 版本安装教程 )
fpga开发·fpga