1.描述电路图里面的一个子模块


Assume that you want to implement hierarchical Verilog code for this circuit,
using three instantiations of a submodule that has a flip-flop and multiplexer in it.
Write a Verilog module (containing one flip-flop and multiplexer) named top_module for this submodule.
module dff(
input clk,
input q_in,
input L,
input r_in,
output reg Q
);
wire data;
always @(posedge clk) begin
Q <= data;
end
assign data = L ? r_in:q_in; endmodule

2.例化子模块


Write the Verilog code for this sequential circuit (Submodules are ok, but the top-level must be named top_module).
Assume that you are going to implement the circuit on the DE1-SoC board.
Connect the R inputs to the SW switches, connect Clock to KEY[0], and L to KEY[1]. Connect the Q outputs to the red lights LEDR.
```C //Connect the R inputs to the SW switches, connect Clock to KEY[0], and L to KEY[1].
//Connect the Q outputs to the red lights LEDR.
module top_module (
input [2:0] SW, // R
input [1:0] KEY, // L and clk
output [2:0] LEDR); // Q
wire Q_0; mt2015_muxdff mt2015_muxdff_ins0(
.clk(KEY[0]),
.L(KEY[1]),
.q_in(LEDR[2]),
.r_in(SW[0]),
.Q(LEDR[0])
); mt2015_muxdff mt2015_muxdff_ins1(
.clk(KEY[0]),
.L(KEY[1]),
.q_in(LEDR[0]),
.r_in(SW[1]),
.Q(LEDR[1])
); mt2015_muxdff mt2015_muxdff_ins2(
.clk(KEY[0]),
.L(KEY[1]),
.q_in(LEDR[1]^LEDR[2]),
.r_in(SW[2]),
.Q(LEDR[2])
);
endmodule module mt2015_muxdff(
input clk,
input q_in,
input L,
input r_in,
output reg Q
);
wire data;
always @(posedge clk) begin
Q <= data;
end
assign data = L ? r_in:q_in;
endmodule

RTL原理图



HDLbits——Mt2015 lfsr的更多相关文章

  1. HDLBits答案——Circuits

    1 Combinational Logic 1.1 Basic Gates 1.1.1 Exams/m2014 q4h module top_module ( input in, output out ...

  2. 尝试设计LFSR加密器,并用CAP4验证随机性

    在CPA4软件中有提供设计LFSR加密器的功能: 输入LFSR的大小,初始密钥,还有反馈密钥. 点击Set Key后点击Show LFSR 观察LFSR,发现初始密钥是1101,转成十六进制是D,反馈 ...

  3. 使用LFSR搭建误差补偿系统

    使用LFSR搭建误差补偿系统 首先弄明白什么是LFSR 线性反馈移位寄存器(LFSR)是内测试电路中最基本的标准模块结构,既用作伪随机测试码产生器,也作为压缩测试结果数据的特征分析器. 一个n阶的LF ...

  4. FPGA入门实例一:LFSR

    一:任务: 要求使用Verilog语言在Xilinx Virtex-6开发板上实现线性反馈移位寄存器(LFSR)的硬件逻辑设计. 二:前期准备: 基本上完成一个简单的设计需要用到以下几个软件 逻辑:U ...

  5. 线性反馈移位寄存器(LFSR)-非线性反馈移位寄存器的verilog实现(产生伪随机数)

    一.线性反馈移位寄存器(LFSR) 通过对事先选定的种子做运算使得人工生成的伪随机序列的过程,在实际中,随机种子的选择决定了输出的伪随机序列的不同,也就是说随机种子的选择至关重要. 产生伪随机数的方法 ...

  6. 学会使用Hdlbits网页版Verilog代码仿真验证平台

    给大家推荐一款网页版的 Verilog代码编辑仿真验证平台,这个平台是国外的一家开源FPGA学习网站,通过“https://hdlbits.01xz.net/wiki/Main_Page” 地址链接进 ...

  7. 线性反馈移位寄存器(LFSR)

    LFSR用于产生可重复的伪随机序列PRBS,该电路有n级触发器和一些异或门组成,如下图所示. 其中,gn为反馈系数,取值只能为0或1,取为0时表明不存在该反馈之路,取为1时表明存在该反馈之路:这里的反 ...

  8. HDLBits答案——Verification: Writing Testbenches

    1 clock module top_module ( ); reg clk; dut U1(.clk(clk)); initial begin clk = 0; end always begin # ...

  9. HDLBits答案——Verification: Reading Simulations

    1 Finding bugs in code 1.1 Bugs mux2 module top_module ( input sel, input [7:0] a, input [7:0] b, ou ...

  10. HDLBits答案——Verilog Language

    Verilog Language 1 Basics 1.1 Wire module top_module( input in, output out ); assign out = in; endmo ...

随机推荐

  1. C++程序设计实验四 继承

    程序源码: #include <iostream> #include <typeinfo> // definitation of Graph class Graph { pub ...

  2. 设置点击事件时Unable to preventDefault inside passive event listener due to target being treated as passive

    问题 当使用fastClick.js设置点击事件时,控制台报错: [Intervention] Unable to preventDefault inside passive event listen ...

  3. N63050 第一周运维作业

    1.按系列罗列Linux的发行版,并描述不同发行版之间的联系与区别. slackware:SUSE Linux Enterprise Server (SLES) , OpenSuse桌面debian: ...

  4. Git下载、安装与配置

    1.Git下载:   访问Git官网,下载对应操作系统的的安装包.   这里笔者是64位机器,选择如下: 2.Git安装:   打开安装包进行安装:   一路next到Finish:   在CMD中输 ...

  5. 安全测试-WEB安全渗透测试基础知识(三)

    1.3. 域名系统 1.3.1. 域名系统工作原理 DNS解析过程是递归查询的,具体过程如下: 用户要访问域名www.example.com时,先查看本机hosts是否有记录或者本机是否有DNS缓存, ...

  6. make 编译笔记

    make 文件位置 默认的make install指令执行之后,会将程序安装到 /usr/local/bin , /usr/local/lib .也可以通过 参数 --prefix 自定义路径,例如 ...

  7. uwsgi部署flask,flask_apscheduler任务遇到各种问题解决

    背景:最近在做的全域事件项目,快要靠近尾声了,需要用到uwsgi部署至生产环境,由于之前是debug模式,运行项目也是通过命令 python manager.py runserver (manage是 ...

  8. CTF学习笔记(三)php部分

    三.常见PHP用法与漏洞 (〇)php的备份文件与phps php的备份文件一般是*.php.bak,在根目录下输入/index.php.bak, 下载 备份文件. phps文件就是php的源代码文件 ...

  9. python multiprocessing调用cython openmp方法需要采用spawn方式

    先说结论,在Linux系统,如果python multiprocessing要调用的cython的方法中包含了多线程,比如openmp C code,必须手动设定spawn方式产生多进程. 更多的细节 ...

  10. win10 + emacs + sml

    1.官网下载sml编译器是smi安装包,安装结束之后把bin文件夹放到环境变量Path中 2.下载emacs压缩包,直接解压 3.emacs中alt+x,输入package-list 然后选择sml- ...