[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
相关推荐
tiger1193 小时前
FPGA独立实现LLM推理方案——FlighLLM
fpga开发·llm·fpga·ai推理
fei_sun4 小时前
Systemverilog和Verilog区别
fpga开发
史蒂芬_丁6 小时前
TI F28P65 使用 ePWM 模块模拟 SPI 时钟的详细方法
单片机·嵌入式硬件·fpga开发
fei_sun9 小时前
HDLBits-Verilog Practice
fpga开发
Aaron15889 小时前
RFSOC+VU13P中在线部分可重构技术的应用分析
人工智能·算法·matlab·fpga开发·重构·信息与通信·信号处理
qxl_79991510 小时前
PCB元件对位:相机采集+YOLO定位完整工程方案(含坐标转换公式)
数码相机·yolo·fpga开发
daxi1501 天前
Verilog入门实战——第5讲:Testbench 仿真编写 + 波形查看与分析
fpga开发
FPGA的花路1 天前
UDP协议
fpga开发·以太网·udp协议
简简单单做算法1 天前
【第2章>第2节】基于FPGA的图像双线性插值实现——理论分析与MATLAB仿真
matlab·fpga·图像双线性插值
LCMICRO-133108477462 天前
长芯微LPS123完全P2P替代ADP123,高性能、低压差的线性稳压器
单片机·嵌入式硬件·fpga开发·硬件工程·dsp开发·线性稳压器