[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 (q511:0), and advance by one time step each clock cycle. The load input indicates the state of the system should be loaded with data511:0. Assume the boundaries (q-1 and q512) 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真舒服

相关推荐
狂奔蜗牛(bradley)7 小时前
拒绝SOEM黑盒!死磕EtherCAT主站:ARM+FPGA架构、DC同步与状态机修复等,50+篇实战开发文档全公开
arm开发·fpga开发·架构
XMAIPC_Robot10 小时前
CODESYS 实时控制 + RK182X 大模型算力扩展|RK3576 工业边缘控制器设计
人工智能·fpga开发·机器人·rk3588+fpga
女神下凡12 小时前
芯参谋(31):SPI NOR Flash 电路设计指南
arm开发·单片机·嵌入式硬件·fpga开发·设计规范
学习FPGA的电气小兴兴15 小时前
基于FPGA的CORDIC旋转模式实现sin和cos运算_采用EGo1板卡上板验证【FPGA数字信号处理第5讲】
fpga开发·信号处理·数字信号处理·verilog·cordic·ego1·fpga设计入门与提高
Eloudy7 天前
开源 gpunetio examples 01 解析 gpunetio_verbs_put_bw
gpu·fpga·rdma·roce·doca
博览鸿蒙7 天前
FPGA开发使用的语言
fpga开发·fpga
明德扬7 天前
机器人多摄像头如何做FPGA多路视频聚合?
学习·fpga开发·fpga
Eloudy7 天前
GPUNetIO开源实现与FPGA的 RoCEv2 通信延迟实验
gpu·fpga·rdma·roce·doca
JoYER_cc8 天前
FPGA 调试实录:LED 闪烁程序从踩坑到仿真验证的完整经验总结
fpga开发
啄缘之间8 天前
1.【SVA】什么是SVA?
经验分享·学习·测试用例·verilog·sva