[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
相关推荐
第二层皮-合肥13 小时前
高速采集卡FPGA设计方案及代码
fpga开发
Runner.DUT15 小时前
详解赛灵思SRIO IP并提供一种FIFO封装SRIO的收发控制器仿真验证
fpga开发
嵌入式-老费16 小时前
再谈fpga开发(fpga调试方法)
fpga开发
千宇宙航18 小时前
闲庭信步使用图像验证平台加速FPGA的开发:第三十三课——车牌识别的FPGA实现(5)车牌字符的识别
自动化·fpga·modelsim·车牌识别·仿真测试平台
XINVRY-FPGA20 小时前
XCZU4EV-1FBVB900E Xilinx FPGA AMD Zynq UltraScale+ MPSoC EV(Embedded Vision)
arm开发·嵌入式硬件·计算机视觉·fpga开发·硬件架构·硬件工程·fpga
从今天开始学习Verilog20 小时前
FFT算法实现之fft IP核
算法·fpga开发
Turing_kun1 天前
基于FPGA的SPI控制FLASH读写
fpga开发
hahaha60161 天前
差模干扰 & 共模干扰
fpga开发
璞致电子2 天前
【PZ-KU060-KFB】——Kintex UltraScale 纯 FPGA 开发平台,释放高速并行计算潜能,高性价比的 FPGA 解决方案
fpga开发·fpga
我爱C编程2 天前
基于FPGA的16QAM软解调+卷积编码Viterbi译码通信系统,包含帧同步,信道,误码统计,可设置SNR
fpga开发·16qam·软解调·帧同步·卷积编码·viterbi译码