[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
相关推荐
ALINX技术博客15 分钟前
【黑金云课堂】FPGA技术教程Linux开发:GPIO 编程/寄存器读写/以太网RJ45
fpga开发
ALINX技术博客8 小时前
AMD VU FPGA+NVIDIA Thor AI 超高性能异构平台 ALINX HEA13,支撑新一代边缘 AI 系统
人工智能·fpga开发
木心术11 天前
如何使用AI agent基于产品技术手册和标准协议完成FPGA寄存器的自动化配置、代码修改和编译的完整方案
人工智能·fpga开发·自动化
unicrom_深圳市由你创科技1 天前
多通道ADDA系统开发需要哪些技术?
fpga开发
ooo-p1 天前
FPGA相关(包含ZYNQ)基础概念理解
fpga开发
又菜又爱玩的东哥1 天前
【FPGA入门实战:Verilog实现边沿检测电路(附Testbench仿真)】
fpga开发
QYR-分析1 天前
FPGA视觉处理板行业发展现状、机遇与未来趋势分析
fpga开发
XMAIPC_Robot2 天前
180FPS AI相机模组,轻巧大算力, 高性能双目同步摄像模组+搭配RK3588
人工智能·嵌入式硬件·深度学习·数码相机·fpga开发
人设定义中...2 天前
电脑上的图片传输到VGA上显示 (设计作业)
fpga开发
XMAIPC_Robot2 天前
基于RK3588 高算力,小尺寸,轻重量6T算力无人机AI模块,可接两路同步相机模组
运维·人工智能·深度学习·fpga开发·无人机·边缘计算