[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
相关推荐
lf28248143117 小时前
03 xilinx除法IP核的使用
fpga开发
智能物联网开发18 小时前
机器人电子皮肤系统开发:36通道柔性触觉阵列 + FPGA高速采集
fpga开发·计算机外设·嵌入式·fpga数据采集
沐欣工作室_lvyiyi19 小时前
基于FPGA的智能音箱设计(论文+源码)
fpga开发·毕业设计·智能音箱
我爱C编程20 小时前
【硬件片内测试】基于FPGA的4FSK扩频通信链路测试,包含帧同步,定时点,扩频伪码同步,信道,误码统计
fpga开发·帧同步·定时点·扩频通信·扩频伪码同步·4fsk
GateWorld20 小时前
Lattice FPGA开发全攻略--十余种输出文件格式及其区别
fpga开发·lattice·fpga开发工具
芯门1 天前
基于 Xilinx K7 FPGA 的全套万兆 10G GigE Vision 商业级传输方案
计算机视觉·fpga开发·万兆gige
ehiway1 天前
FPGA在未来产业中的应用潜力与商业机会分析
fpga开发
GateWorld1 天前
FPGA内部模块详解之第1篇 FPGA内部结构总览
fpga开发·fpga内部模块
爱吃汽的小橘1 天前
驱动GPIO使用GPIO中断模式
fpga开发
普密斯科技2 天前
精准把控每一处细节——FPGA焊点高度精准检测实施方案
人工智能·深度学习·数码相机·计算机视觉·fpga开发·测量