[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
相关推荐
ShiMetaPi7 小时前
GM-3568JHF丨ARM+FPGA异构开发板应用开发教程:11 RS485读写案例
arm开发·fpga开发·rk3568
1560820721911 小时前
国产时钟AU5615芯片调试记录
fpga开发
嵌入式-老费15 小时前
Linux camera驱动开发(特殊的cpu+fpga芯片)
图像处理·驱动开发·fpga开发
ShiMetaPi16 小时前
GM-3568JHF丨ARM+FPGA异构开发板应用开发教程:10 以太网测试案例
网络·arm开发·fpga开发·rk3568
Echo_cy_16 小时前
ZYNQ嵌入式最小系统配置:ZYNQ7000与ZYNQMP系列
fpga开发·vivado·zynq7000·zynqmp
1560820721918 小时前
复旦微JFM9RFRF3P/RF3P5G+AI(昇腾310P)全国产采集回放/信号处理模块
人工智能·fpga开发
FPGA小c鸡1 天前
FPGA跨时钟域设计完全指南:从亚稳态到CDC同步器(附实战案例与代码)
fpga开发
FPGA小c鸡3 天前
异步FIFO设计与验证完全指南:从格雷码到CDC同步的深度解析(附SystemVerilog实战代码)
fpga开发
春风细雨无声3 天前
基于FPGA实现PAL视频接口(附代码)
图像处理·fpga开发·视频
算法笑匠3 天前
FPGA驱动AD9226实现65MSPS高速数据采集
fpga·adc·高速数据采集·ad9226