[HDLBits] Mt2015 lfsr

Taken from 2015 midterm question 5. See also the first part of this question: mt2015_muxdff

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.

复制代码
module top_module (
	input [2:0] SW,      // R
	input [1:0] KEY,     // L and clk
	output [2:0] LEDR);  // Q
	wire result;
    parts part1(KEY[0],KEY[1],SW[0],LEDR[2],LEDR[0]);
    parts part2(KEY[0],KEY[1],SW[1],LEDR[0],LEDR[1]);
    assign result=LEDR[2]^LEDR[1];
    parts part3(KEY[0],KEY[1],SW[2],result,LEDR[2]);
endmodule
        
        
module parts(
	input clk,
	input l,
	input r,
    input q1,
    output Q);
    wire d;
    assign d=l?r:q1;
    always@(posedge clk) begin
        Q<=d;
    end
endmodule
相关推荐
zly88653728 小时前
MMIO机制详解
fpga开发
北京青翼科技10 小时前
【PXIE301-211】基于PXIE总线的16路并行LVDS数据采集、1路光纤数据收发处理平台
图像处理·fpga开发·信号处理
霖0014 小时前
PCIe数据采集系统
数据结构·经验分享·单片机·嵌入式硬件·fpga开发·信号处理
FakeOccupational15 小时前
fpga系列 HDL : Microchip FPGA开发软件 Libero Soc 安装 & license申请
fpga开发
千歌叹尽执夏17 小时前
FPGA: UltraScale+ bitslip实现(ISERDESE3)
fpga开发·training·ultrascale+·bitslip
zly886537219 小时前
MLX5 Linux 驱动代码分析
linux·运维·fpga开发
ALINX技术博客21 小时前
【ALINX 实战笔记】FPGA 大神 Adam Taylor 使用 ChipScope 调试 AMD Versal 设计
笔记·fpga开发
Yesheldon1 天前
Cadence 高速系统设计流程及工具使用三
嵌入式硬件·fpga开发·硬件架构·硬件工程·智能硬件
搬砖的小码农_Sky1 天前
FPGA:Xilinx Kintex 7实现DDR3 SDRAM读写
fpga开发·硬件架构·硬件工程
小眼睛FPGA2 天前
why FPGA喜欢FMC子卡?
fpga开发