[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
相关推荐
s090713619 小时前
FPGA中同步与异步复位
fpga开发·verilog·xilinx·zynq
tiantianuser1 天前
RDMA设计15:连接管理模块设计2
网络协议·fpga开发·rdma·高速传输·cmac
民乐团扒谱机1 天前
十字路口交通信号灯控制器设计(Multisim 电路 + Vivado 仿真)
单片机·fpga开发·verilog·状态机·仿真·时序逻辑·multism
乌恩大侠1 天前
一文讲解 USRP X410
fpga开发·usrp
s09071361 天前
多波束声呐 FPGA 信号处理链路介绍
算法·fpga开发·信号处理·声呐
坏孩子的诺亚方舟1 天前
FPGA系统架构设计实践11_FPGA开机
fpga开发·系统架构·xilinx·fpga配置
晓晓暮雨潇潇2 天前
Diamond基础6:LatticeFPGA配置流程
fpga开发·diamond·lattice·latticeecp3
江蘇的蘇2 天前
基于7系列FPGA实现万兆网通信
fpga开发
GateWorld2 天前
FPGA实战:一段让我重新认识时序收敛的FPGA迁移之旅
fpga开发·实战经验·fpga时序收敛·建立保持时间
GateWorld2 天前
性能飞跃:DDR4特性解析与FPGA实战指南
fpga开发·信号完整性·ddr3·ddr4