[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
相关推荐
szxinmai主板定制专家8 小时前
基于ZYNQ MPSOC图像采集与压缩系统总体设计方案
linux·arm开发·人工智能·嵌入式硬件·fpga开发
hhb_61810 小时前
VHDL设计难点与实战案例精解
fpga开发
阳排13 小时前
FT2232芯片通过JTAG连接Xilinx FPGA
fpga开发
szxinmai主板定制专家14 小时前
基于ZYNQ MPSOC ARM+FPGA的超高清实时图像采集与压缩系统设计
linux·运维·服务器·arm开发·人工智能·嵌入式硬件·fpga开发
GateWorld14 小时前
LCD显示技术完全指南:原理·制造·驱动·FPGA实现之驱动三
fpga开发·lcd显示·fpga点亮屏幕·minilvds
FPGA的花路1 天前
基于脚本的ModelSim自动化仿真(Xilinx FPGA篇)
fpga开发·xilinx·自动化脚本·modelsim仿真
汽车仪器仪表相关领域2 天前
Kvaser Hybrid Pro 2xCAN/LIN 双通道可编程CAN/LIN通讯接口:一机双模可编程,汽车车身混合总线测试专用设备
人工智能·功能测试·安全·fpga开发·汽车·压力测试
szxinmai主板定制专家2 天前
电力设备RK3568/RK3576+FPGA,多系统混合部署Linux+RTOS RT-THREAD,强实时性
linux·运维·服务器·人工智能·嵌入式硬件·fpga开发
ALINX技术博客2 天前
【黑金云课堂】FPGA技术教程Vitis开发:PS端DP接口解析
fpga开发·fpga
FakeOccupational2 天前
fpga系列 HDL:跨时钟域同步 shift register同步(CDC)毛刺滤除&解码前去抖动滤波模块
fpga开发