[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
相关推荐
Hello-FPGA1 小时前
AI 如何自动通过 PDF 原理图生成管脚映射
人工智能·fpga开发·pdf
zlinear数据采集卡1 小时前
数据采集卡从入门到精通(7):流水线型ADC——级级接力,高速与高精的平衡术
开发语言·arm开发·嵌入式硬件·fpga开发·c#
鬼手点金17 小时前
FPGA常用型号参考
fpga开发·verilog·vivado·xilinx·vhdl·altera·lattice
FPGA-ADDA18 小时前
雷通微系统推出RTSD2605:RFSoC + 英伟达GPU一体化信号处理平台
信号处理·fpga·rfsoc·zu47dr·47dr
Kong_19942 天前
芯片开发学习笔记·二十九——大模型基础知识与 KV Cache 详解
fpga开发·芯片开发
m0_46644103詹湛2 天前
FPGA 定点数、小数与负数的加减乘除原理
fpga开发
zlinear数据采集卡2 天前
D223上位机C#开发实战:从帧解析到波形显示的完整实现
开发语言·arm开发·嵌入式硬件·fpga开发·开源·c#
zlinear数据采集卡2 天前
D223 ADC数据处理流水线:从原始采样值到工程单位的完整转换链
开发语言·arm开发·嵌入式硬件·fpga开发·开源·c#
FPGA小迷弟2 天前
Vivado中高速收发器GTX/GTH的配置与调试实战
fpga开发·fpga·硬件开发
minglie12 天前
简易寄存器接口SMMR---iic控制器
fpga开发