[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
相关推荐
LCMICRO-133108477463 小时前
长芯微LD9689完全P2P替代AD9689,是一款双通道、14位、2.0 GSPS/2.6 GSPS模数转换器(ADC)
网络·单片机·嵌入式硬件·网络协议·fpga开发·硬件工程·高速adc
萨文 摩尔杰13 小时前
GPS原理学习
学习·fpga开发
Huangichin14 小时前
跟着Gemini学System Verilog
fpga开发
LCMICRO-1331084774616 小时前
长芯微LDC90810完全P2P替代ADC128D818,是一款八通道系统监控器,专为监控复杂系统状态而设计。
stm32·单片机·嵌入式硬件·fpga开发·硬件工程·模数转换芯片adc
迎风打盹儿18 小时前
FPGA中if-else和case的理解:综合出来的电路真的会有优先级吗?
fpga·优先级·综合·case·if-else
s090713619 小时前
保姆级教程十二:USB摄像头接入!ZYNQ+OpenCV+FPGA硬件加速图像处理实战(视觉终极篇)
图像处理·opencv·fpga开发·zynq·硬件加速
CoderIsArt1 天前
FPGA-based 量子电路仿真
fpga开发
碎碎思1 天前
升级版流水灯:用FPGA控制上千颗RGB LED
fpga开发
FPGA-ADDA1 天前
第二篇:Xilinx 7系列FPGA详解——从Spartan到Virtex
fpga开发·fpga·sdr·rfsoc
逐步前行2 天前
STM32_SysTick_寄存器操作
stm32·嵌入式硬件·fpga开发