[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
相关推荐
化屾为海37 分钟前
FPGA制造与测试全流程
fpga开发·制造
Aaron15881 小时前
RFSOC+VU13P+RK3588的核心优势与应用场景分析
嵌入式硬件·算法·matlab·fpga开发·信息与通信·信号处理·基带工程
Aaron15884 小时前
8通道测向系统演示科研套件
人工智能·算法·fpga开发·硬件工程·信息与通信·信号处理·基带工程
数字芯片实验室7 小时前
当FPGA开始支持“自然语言编程“,芯片定制的门槛要变了
fpga开发
Kong_199410 小时前
芯片开发学习笔记·二十四——PCIe(PCI Express)
fpga开发·芯片开发
化屾为海10 小时前
FPGA CP测试
fpga开发
何如呢11 小时前
ROM查表法实现UW
fpga开发
碎碎思12 小时前
FPGA图像处理平台搭建:MIPI + VDMA + Ethernet全流程
图像处理·人工智能·fpga开发
希言自然也1 天前
赛灵思KU系列FPGA的EFUSE/BBRAM加密操作
fpga开发
Terasic友晶科技1 天前
答疑解惑 | DE25-Nano开发板Uboot阶段与FPGA外设交互失败
fpga开发·led·uboot·de25-nano·terasic