[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
相关推荐
爱吃汽的小橘1 天前
异步串口通信和逻辑分析仪
运维·服务器·网络·单片机·嵌入式硬件·fpga开发
bnsarocket1 天前
Verilog和FPGA的自学笔记3——仿真文件Testbench的编写
笔记·fpga开发·verilog·自学
Eloudy2 天前
Verilog可综合电路设计:重要语法细节指南
fpga开发
ARM+FPGA+AI工业主板定制专家2 天前
基于ZYNQ FPGA+AI+ARM 的卷积神经网络加速器设计
人工智能·fpga开发·cnn·无人机·rk3588
szxinmai主板定制专家2 天前
基于 ZYNQ ARM+FPGA+AI YOLOV4 的电网悬垂绝缘子缺陷检测系统的研究
arm开发·人工智能·嵌入式硬件·yolo·fpga开发
ooo-p2 天前
FPGA学习篇——Verilog学习之计数器的实现
学习·fpga开发
bnsarocket3 天前
Verilog和FPGA的自学笔记1——FPGA
笔记·fpga开发·verilog·自学
最遥远的瞬间3 天前
一、通用的FPGA开发流程介绍
fpga开发
weixin_450907283 天前
第八章 FPGA 片内 FIFO 读写测试实验
fpga开发
helesheng3 天前
用低成本FPGA实现FSMC接口的多串口(UART)控制器
stm32·fsmc·fpga·uart控制器