[HDLBits] Exams/2014 q4b

Consider the n-bit shift register circuit shown below:

Write a top-level Verilog module (named top_module) for the shift register, assuming that n = 4. Instantiate four copies of your MUXDFF subcircuit in your top-level module. Assume that you are going to implement the circuit on the DE2 board.

  • Connect the R inputs to the SW switches,
  • clk to KEY0,
  • E to KEY1,
  • L to KEY2, and
  • w to KEY3.
  • Connect the outputs to the red lights LEDR3:0.

(Reuse your MUXDFF from exams/2014_q4a.)

复制代码
module top_module (
    input [3:0] SW,
    input [3:0] KEY,
    output [3:0] LEDR
); //
    MUXDFF d3(SW[3],KEY[3],KEY[1],KEY[2],KEY[0],LEDR[3]);
    MUXDFF d2(SW[2],LEDR[3],KEY[1],KEY[2],KEY[0],LEDR[2]);
    MUXDFF d1(SW[1],LEDR[2],KEY[1],KEY[2],KEY[0],LEDR[1]);
    MUXDFF d0(SW[0],LEDR[1],KEY[1],KEY[2],KEY[0],LEDR[0]);
endmodule

module MUXDFF (
	input r,w,e,l,
    input clk,
    output q);
	wire d;
    assign d=(l?r:(e?w:q));
    always@(posedge clk) begin
        q<=d;
    end
endmodule
相关推荐
unicrom_深圳市由你创科技2 小时前
高帧率机器视觉 FPGA 图像板卡及传输开发定制解决方案
fpga开发
幻智星科技19 小时前
纯FPGA网络通信实现微秒级确定性延迟
网络协议·fpga开发·硬件架构
泡泡糖的中文规格书21 小时前
HDLbits 1.5 学习笔记
fpga开发
幻智星科技1 天前
FPGA不同品牌开发平台约束文件迁移难题解析
fpga开发·架构·硬件架构
幻智星科技1 天前
Karatsuba与CSD优化FPGA大数乘法
c++·fpga开发·密码学
星夜离尘561 天前
FPGA 实战:W1C 中断状态寄存器,事件置位与软件清除撞在同一拍怎么办
fpga开发
像枫一样1 天前
STM32串口轮询收发实战教程
arm开发·c++·stm32·单片机·嵌入式硬件·fpga开发·51单片机
传感器与混合集成电路1 天前
DLM8676计数控制集成电路DC-DC一体化与RS422隔离接口设计
fpga开发
嵌入式软硬件攻城狮2 天前
9.读写DDR测试
fpga开发
幻智星科技2 天前
多通道数据采集DMA设计详解
fpga开发·udp·硬件架构