博客
关于我
HDLbits笔记-More Circuits
阅读量:160 次
发布时间:2019-02-28

本文共 1435 字,大约阅读时间需要 4 分钟。

Rule90

题目:Rule 90是一个一维的有趣的元胞自动机。规则很简单,在每一个时间步长,每一个元胞的下一个状态为与这个元胞相邻两个元胞的异或。规则如下表:

在这里插入图片描述

module top_module(    input clk,    input load,    input [511:0] data,    output [511:0] q );     integer		i;    always@(posedge clk)begin        if(load)            q	<=	data;        else begin            q[0] <= 1'b0 ^ q[1];            for(i = 0; i < 510; i = i + 1)begin                if(q[i]^q[i+2])                     q[i+1]	<=	1'b1;                else                    q[i+1]	<=	1'b0;            end            q[511] <= q[510] ^ 1'b0;        end    endendmodule

这里主要注意你的for循环不要超出定义的数组范围。还有一种方法,简洁但是不易明白:

module top_module(    input clk,    input load,    input [511:0] data,    output [511:0] q );        always @(posedge clk) began        if(load) began            q <= data;            end        else began            q <= {   1'b0, q[511:1]}  ^ {q[510:0], 1'b0};            end    endendmodule

Rule 110

题目:

Rule 110是一个一维的有趣的元胞自动机。规则很简单,在每一个时间步长,每一个元胞的下一个状态为与这个元胞相邻两个元胞的异或。规则如下表:
在这里插入图片描述

module top_module(    input clk,    input load,    input [511:0] data,    output [511:0] q);     always@(posedge clk)begin        if(load)begin            q <= data;        end        else begin            q <= ~q & {   q[510:0], 1'b0} |             	~{   1'b0, q[511:1]} & {q[510:0], 1'b0} |             	~{   1'b0, q[511:1]} & q |             	q & ~{   q[510:0], 1'b0};        end    endendmodule

Conways Game of Life 16x16

这道题目博主太菜,目前还没有做出来,感觉有很多种相邻的情况啊。。。

转载地址:http://yejj.baihongyu.com/

你可能感兴趣的文章
MySQL8.0.29启动报错Different lower_case_table_names settings for server (‘0‘) and data dictionary (‘1‘)
查看>>
MYSQL8.0以上忘记root密码
查看>>
Mysql8.0以上重置初始密码的方法
查看>>
mysql8.0新特性-自增变量的持久化
查看>>
Mysql8.0注意url变更写法
查看>>
Mysql8.0的特性
查看>>
MySQL8修改密码报错ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
查看>>
MySQL8修改密码的方法
查看>>
Mysql8在Centos上安装后忘记root密码如何重新设置
查看>>
Mysql8在Windows上离线安装时忘记root密码
查看>>
MySQL8找不到my.ini配置文件以及报sql_mode=only_full_group_by解决方案
查看>>
mysql8的安装与卸载
查看>>
MySQL8,体验不一样的安装方式!
查看>>
MySQL: Host '127.0.0.1' is not allowed to connect to this MySQL server
查看>>
Mysql: 对换(替换)两条记录的同一个字段值
查看>>
mysql:Can‘t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock‘解决方法
查看>>
MYSQL:基础——3N范式的表结构设计
查看>>
MYSQL:基础——触发器
查看>>
Mysql:连接报错“closing inbound before receiving peer‘s close_notify”
查看>>
mysqlbinlog报错unknown variable ‘default-character-set=utf8mb4‘
查看>>