[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
相关推荐
博览鸿蒙8 小时前
FPGA 工程中常见的基础硬件问题
fpga开发
GateWorld12 小时前
FPGA 实现无毛刺时钟切换
fpga开发·实战·无毛刺时钟
Seraphina_Lily14 小时前
从接口选型到体系结构认知——谈 CPU–FPGA–DSP 异构处理系统与同构冗余设计
fpga开发
Seraphina_Lily16 小时前
CPU–FPGA–DSP 异构系统中的总线接口选型——为什么 CPU 用 eLBC,而 DSP 用 XINTF?
fpga开发
GateWorld16 小时前
FPGA开发十年心路
fpga开发
ALINX技术博客1 天前
【ALINX 教程】FPGA Multiboot 功能实现——基于 ALINX Artix US+ AXAU25 开发板
fpga开发·fpga
Genevieve_xiao1 天前
【verilog】如何一小时成为verilog高手(并非
fpga开发
从此不归路1 天前
FPGA 结构与 CAD 设计(第3章)上
ide·fpga开发
Aaron15882 天前
基于VU13P在人工智能高速接口传输上的应用浅析
人工智能·算法·fpga开发·硬件架构·信息与通信·信号处理·基带工程
jz_ddk2 天前
[实战] Zynq-7000 PCAP接口完全指南
fpga·ps·zynq·pcap·pl