[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
相关推荐
xyx-3v9 小时前
zynq7010和zynq7020的区别
fpga开发
xyx-3v11 小时前
LUT(Look-Up Table,查找表)的定义与核心概念
fpga开发
明德扬1 天前
K7+AD9144 多模式实测|8 种 JESD204B 配置全覆盖验证
fpga开发
xyx-3v1 天前
SOC相对于版上系统的优势是什么?
fpga开发
Aaron15882 天前
RFSOC+VU13P+GPU 在6G互联网中的技术应用
大数据·人工智能·算法·fpga开发·硬件工程·信息与通信·信号处理
stars-he3 天前
基于 Design Compiler 的 UDP Payload 追加控制模块综合与门级后仿真
笔记·fpga开发·udp
林伟_fpga3 天前
FPGA助力激光增材制造的熔池实时干预、探索TC11钛合金的类“钢筋混凝土”晶粒结构的优化路径
fpga
尤老师FPGA3 天前
HDMI数据的接收发送实验(十)
fpga开发
逻辑诗篇3 天前
破核拆解:PCIE719——基于Xilinx Zynq UltraScale+的高性能SAS扩展卡设计
fpga开发·架构
逻辑诗篇3 天前
高性能存储扩展利器|PCIE719 基于Zynq UltraScale+的企业级可编程SAS方案
fpga开发