[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
相关推荐
坏孩子的诺亚方舟4 小时前
FPGA设计基于团队的最佳实践2_IP及设计重用&功能验证&时序收敛
fpga
我送炭你添花7 小时前
电子世界的奇妙冒险:从一个电阻开始(系列目录)
人工智能·单片机·嵌入式硬件·fpga开发
知识充实人生9 小时前
FPGA设计杂谈之九:HRIO/HPIO/HDIO
fpga开发·xilinx·hr i/o·hp i/o·hd i/o·io类型
maverick_11118 小时前
【FPGA】 在Verilog中,! 和 ~ 的区别
fpga开发
黄埔数据分析2 天前
QDMA把描述符当数据搬移, 不用desc engine
fpga开发
南檐巷上学2 天前
基于FPGA的正弦信号发生器、滤波器的设计(DAC输出点数受限条件下的完整正弦波产生器)
fpga开发·数字信号处理·dsp·dds
嵌入式-老费2 天前
Linux Camera驱动开发(fpga + csi rx/csi tx)
fpga开发
ALINX技术博客3 天前
【202601芯动态】全球 FPGA 异构热潮,ALINX 高性能异构新品预告
人工智能·fpga开发·gpu算力·fpga
minglie13 天前
GCC的__attribute__用法
fpga
minglie13 天前
Zynq上UART/IIC/SPI的27个实验-第15课:PL 逻辑模拟 IIC 从设备AT24C256 行为
fpga