[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
相关推荐
威嵌神州18 分钟前
天脉 3 开发环境与 BSP 适配:IDE license、驱动开发、飞腾平台
ide·驱动开发·嵌入式硬件·fpga开发
Eloudy26 分钟前
RAM Player 实验:hololink-write 开流 + RoCEv2 接收分析
fpga
FPGA小迷弟12 小时前
FPGA 应用技术能力的完整闭环(5-8)
fpga开发·dsp开发·fpga·sdr·无线电
狂奔蜗牛(bradley)13 小时前
搞定100ns抖动:ARM+FPGA混合EtherCAT主站实战方案
嵌入式硬件·fpga开发
Eloudy17 小时前
vitis 工程 ping FPGA 丢包(~50% 随机)问题分析
fpga
free-elcmacom18 小时前
FPGA学习笔记<2>Verilog输入
fpga开发·硬件工程
学习FPGA的电气小兴兴20 小时前
基于FPGA的CORDIC向量模式实现arctan运算,Verilog HDL实现
嵌入式硬件·fpga开发·数字信号处理·verilog·fpga·cordic·arctan
FPGA小迷弟2 天前
FPGA 应用技术能力的完整闭环(1-4)
fpga开发·dsp开发·fpga·sdr·无线电
NamoAmitabha1282 天前
vivado时序报红/插入流水线寄存器/降低扇出
fpga·vivado
Eloudy2 天前
FPGA 开发与 IC 数字前端设计
fpga开发