[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
相关推荐
FPGA小c鸡3 小时前
FPGA卷积层流水线加速:从入门到精通(附完整SystemVerilog实现)
fpga开发
数字芯片实验室3 小时前
仿真器出bug了?分频时钟竞争的诡异仿真现象
fpga开发·bug
从此不归路4 小时前
FPGA 结构与 CAD 设计(第4章)下
fpga开发
Terasic友晶科技5 小时前
7-DE10-Nano的HDMI方块移动案例的整体实现(含Quartus完整工程免费下载)
fpga开发·i2c·pll·de10-nano·hdmi传输·方块移动案例·quartus prime
碎碎思5 小时前
使用 Arm Cortex-M1 实现低成本图像处理系统 的 FPGA 方案详解
arm开发·图像处理·人工智能·fpga开发
minglie16 小时前
PetaLinux工程目录设备树文件结构与作用
fpga开发
最遥远的瞬间6 小时前
二、FPGA程序固化
fpga开发
Ghost Face...6 小时前
内存调试:2T/3T模式配置实战指南
fpga开发
海涛高软6 小时前
Verlog实现串口的收发功能
fpga开发
从此不归路7 小时前
FPGA 结构与 CAD 设计(第4章)上
ide·fpga开发