[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 小时前
使用python绘图分析电池充电曲线
开发语言·python·stm32·单片机·fpga开发·51单片机
尤老师FPGA1 小时前
LVDS系列44:Xilinx Ultrascale系 ADC LVDS接口参考方法(六)
fpga开发
化屾为海2 小时前
FPGA之PLL展频
fpga开发
GateWorld3 小时前
FPGA内部模块详解之七 FPGA的“灵魂”加载——配置模块(Configuration)深度解析
fpga开发·fpga config
星华云4 小时前
[FPGA]Spartan6 Uart可变波特率读写JY901P惯导模块
fpga开发·verilog·jy901p·spartan6·惯导
碎碎思4 小时前
基于 Gowin FPGA 的 SDR 开源方案:从硬件到射频全栈打通
fpga开发
S&Z346316 小时前
[SZ901]高级功能:远程调试
fpga开发
醇氧17 小时前
【学习】冯诺依曼架构和哈弗架构
fpga开发
尤老师FPGA19 小时前
HDMI数据的接收发送实验(七)
fpga开发
学习永无止境@19 小时前
FPGA设计中,主时钟与虚拟时钟的定义
fpga开发