[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鸡22 分钟前
FPGA DSP与AI加速应用案例集合:从入门到精通的完整指南
人工智能·fpga开发
Fpga_User36 分钟前
关于selectio IP的一些问题
fpga开发·ip
minglie15 小时前
AXI UART_LITE linux测试
fpga开发
Terasic友晶科技8 小时前
2-DE10-Nano的HDMI彩条显示案例(分辨率可切换)—— VGA显示控制器模块设计
fpga开发·de10-nano·hdmi彩条显示·vga显示控制·terasic开发板
kanhao1009 小时前
电平交叉采样 (Level-Crossing Sampling)
算法·fpga开发·fpga
忙什么果20 小时前
上位机、下位机、FPGA、算法放在哪层合适?
算法·fpga开发
环能jvav大师1 天前
在Proteus中仿真PLD元器件(WinCupl及WinSim基础使用)
硬件架构·proteus·fpga
博览鸿蒙1 天前
从迷茫自学到稳定入行:我的 FPGA 上岸全过程
fpga开发
芯门1 天前
FPGA商用级ISP(二):镜头阴影校正(LSC)的网格增益插值与并行硬件架构实现
图像处理·fpga开发·isp
Felven1 天前
corundum 40G开源网卡测试结果
fpga开发·性能测试·dds·开源网卡·mqnic