[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
相关推荐
brave and determined1 天前
可编程逻辑器件学习(day26):低主频FPGA为何能碾压高主频CPU?
人工智能·嵌入式硬件·深度学习·学习·fpga开发·云计算·fpga
邮专薛之谦1 天前
Verilog 语言基础学习
fpga开发
the sun341 天前
数电基础:移位寄存器、顺序脉冲、序列信号发生器
单片机·嵌入式硬件·fpga开发·数电
brave and determined2 天前
可编程逻辑器件学习(day24):异构计算:突破算力瓶颈的未来之路
人工智能·嵌入式硬件·深度学习·学习·算法·fpga·asic
海涛高软3 天前
yolov8目标检测训练在rk3588上部署
fpga开发
第二层皮-合肥3 天前
USB3.0专题-硬件的测试
fpga开发
hexiaoyan8273 天前
高速数据采集卡设计方案:886-基于RFSOC的8路5G ADC和8路9G的DAC PCIe卡
fpga开发·高速数据采集卡·光纤pcie卡·通用pcie卡·xc7a100t板卡
坏孩子的诺亚方舟3 天前
FPGA系统架构设计实践7_时序收敛作业概述
fpga·xilinx·时序收敛·作业流程
嵌入式软硬件攻城狮3 天前
2.FPGA板卡通过电脑映射连接上网
fpga开发·电脑
brave and determined3 天前
可编程逻辑器件学习(day22):“让ARM穿上FPGA的马甲“:赛灵思Zynq的命名哲学与技术革命
arm开发·嵌入式硬件·fpga开发·zynq·fpga设计·嵌入式设计·fpga开发流程