[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 KEY0, and L to KEY1. 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
相关推荐
传感器与混合集成电路1 天前
伺服数据采集控制模块系统集成实战手册:接口设计要点、上电顺序与开发环境配置全解析
fpga开发
xxLearn1 天前
Vivado 2025.2 下载程序时提示:“ERROR : invalid command name ps7_init“
fpga开发
科恒盛远2 天前
【无标题】
fpga开发·硬件工程·信号处理
千寻xun2 天前
一、理论篇-NVME协议学习笔记
笔记·学习·fpga开发·nvme ssd·nvme协议
AndyHeee2 天前
【PCIe中的BAR、MMIO、MMU、mmap函数与页表】
fpga开发
nuoxin1143 天前
HR4988替代A4988-富利威
网络·人工智能·嵌入式硬件·fpga开发·dsp开发
一口一口吃成大V3 天前
vivado的bit 和 bin的区别
fpga开发
尤老师FPGA4 天前
HDMI数据的接收发送实验(十八)
fpga开发
北京青翼科技4 天前
青翼科技 JFM7K325T FPGA+FT-M6678 DSP 的全国产化信号处理平台丨FPGA开发板
fpga开发·数据采集卡·fmc子卡·fpga开发板·ad采集卡·图像处理卡·dsp信号处理
zlinear数据采集卡4 天前
从0到1硬核拆解:工业级数据采集卡的隔离设计与Modbus通信实战
arm开发·单片机·嵌入式硬件·fpga开发·开源