[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
相关推荐
Nobody331 小时前
锁存器与触发器
fpga开发
Nobody332 小时前
跨时钟域信号处理的办法有哪些
fpga开发·信号处理
LCMICRO-133108477463 小时前
长芯微LPC556D1完全P2P替代DAC8830,是引脚兼容的16位数模转换器,该系列产品为单通道、低功耗、缓冲电压输出型DAC
stm32·单片机·嵌入式硬件·fpga开发·硬件工程·电压输出型dac
北城笑笑5 小时前
FPGA 与 市场主流芯片分类详解:SoC/CPU/GPU/DPU 等芯片核心特性与工程应用
前端·单片机·fpga开发·fpga
R.X. NLOS5 小时前
ZYNQ 开发知识点记录:AXI Timer 硬件定时器与中断机制解密
fpga开发·fpga·axi定时器
北城笑笑6 小时前
FPGA 51,基于 ZYNQ 7Z010 的 FPGA 高速路由转发加速系统架构设计(Xilinx ZYNQ-MINI 7Z010 CLG400 -1)
前端·fpga开发·系统架构·fpga
学习永无止境@6 小时前
MATLAB中矩阵转置
算法·matlab·fpga开发·矩阵
fei_sun6 小时前
【Verilog】阻塞/非阻塞赋值
fpga开发
minglie17 小时前
正点原子zynq的RGB彩条实验
fpga开发
FPGA-ADDA7 小时前
第六篇:多速率信号处理——抽取、插值与半带滤波器
fpga开发·信号处理·软件无线电·rfsoc·47dr