[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
相关推荐
cjie22115 小时前
DDR3速率分档
fpga开发
坏孩子的诺亚方舟1 天前
open_prj22_IIC读写EEPROM、AD/DA、PLSYSMON
fpga开发·mpsoc
cjie2211 天前
仿真xilinx库加glbl()的作用
fpga开发
禾刀围玉1 天前
基于FPGA的卷积神经网络实现-方案构想
人工智能·fpga开发·cnn
Aaron15881 天前
全频段 SDR干扰源模块解决方案(星链干扰、LORA无人机干扰)
人工智能·算法·fpga开发·硬件架构·硬件工程·无人机·信息与通信
Kent Gu2 天前
FPGA JTAG确认
fpga开发
北京青翼科技2 天前
基于VITA57.1的2路125MSPS AD采集、2路250MSPS DA回放FMC子卡丨青翼科技100%国产采集卡
fpga开发·数据采集卡·fmc子卡·ad采集卡
小麦嵌入式2 天前
FPGA入门(四):时序逻辑计数器原理与 LED 闪烁实现
linux·驱动开发·stm32·嵌入式硬件·fpga开发·硬件工程·dsp开发
ALINX技术博客2 天前
【黑金云课堂】FPGA技术教程FPGA基础:呼吸灯实验+RAM/ROM IP设计与验证
网络协议·fpga开发·fpga
ALINX技术博客2 天前
【黑金云课堂】FPGA技术教程Vitis开发:PS端IIC通信
fpga开发·fpga