[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
相关推荐
爱吃汽的小橘11 小时前
用串口控制DAC
fpga开发
FPGA_ADDA16 小时前
RFSOC27DR+VU13P 6U VPX板卡
fpga开发·信号处理·adda射频采集·rfsoc27dr·vu13p
ARM+FPGA+AI工业主板定制专家16 小时前
【JETSON+FPGA+GMSL】实测分享 | 如何实现激光雷达与摄像头高精度时间同步?
人工智能·数码相机·机器学习·fpga开发·机器人·自动驾驶
白码王子小张16 小时前
FPGA实现CIC抽取滤波器
fpga开发·vivado·xilinx·cic滤波器
沉默_是金17 小时前
2024年江苏省大学生电子设计竞赛 || 无线传输信号模拟系统
fpga开发
ARM+FPGA+AI工业主板定制专家17 小时前
Jetson AGX Orin+GMSL+AI视觉开发套件,支持自动驾驶,机器人,工业视觉等应用
人工智能·机器学习·fpga开发·机器人·自动驾驶
ARM+FPGA+AI工业主板定制专家20 小时前
【JETSON+FPGA+GMSL+AI】自动驾驶与移动机器人的摄像头如何实现高精度时间同步?
网络·人工智能·机器学习·fpga开发·cnn·自动驾驶
cycf1 天前
源同步接口(六)
fpga开发
电子凉冰1 天前
FPGA强化-简易电压表的设计与验证
fpga开发
国科安芯1 天前
抗辐照MCU芯片在低轨商业卫星原子钟中的适配与优化
单片机·嵌入式硬件·fpga开发·架构·risc-v