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 KEY[0],

  • E to KEY[1],

  • L to KEY[2], and

  • w to KEY[3].

  • Connect the outputs to the red lights LEDR[3:0].

    module top_module (
    input [3:0] SW,
    input [3:0] KEY,
    output [3:0] LEDR
    ); //

    复制代码
      MUXDFF MUX_3(
          .clk	(KEY[0]),
          .e		(KEY[1]),
          .l		(KEY[2]),
          .r		(SW[3]),
          .w		(KEY[3]),
      
          .Q     (LEDR[3])

    );

    复制代码
      MUXDFF MUX_2(
          .clk	(KEY[0]),
          .e		(KEY[1]),
          .l		(KEY[2]),
          .r		(SW[2]),
          .w		(LEDR[3]),
      
          .Q     (LEDR[2])

    );

    复制代码
      MUXDFF MUX_1(
          .clk	(KEY[0]),
          .e		(KEY[1]),
          .l		(KEY[2]),
          .r		(SW[1]),
          .w		(LEDR[2]),
      
          .Q     (LEDR[1])

    );

    复制代码
      MUXDFF MUX_0(
          .clk	(KEY[0]),
          .e		(KEY[1]),
          .l		(KEY[2]),
          .r		(SW[0]),
          .w		(LEDR[1]),
      
          .Q     (LEDR[0])

    );

    endmodule

    module MUXDFF (
    input clk,
    input e,
    input l,
    input r,
    input w,

    复制代码
      output Q

    );
    wire temp0;
    wire temp1;
    assign temp0 = e? w : Q;
    assign temp1 = l? r : temp0;

    复制代码
      always@(posedge clk)
          begin 
              Q <= temp1;
          end

    endmodule

相关推荐
民乐团扒谱机5 小时前
十字路口交通信号灯控制器设计(Multisim 电路 + Vivado 仿真)
单片机·fpga开发·verilog·状态机·仿真·时序逻辑·multism
9527华安11 天前
FPGA纯verilog实现JESD204B协议,基于ADRV9009数据环回收发,提供2套工程源码和技术支持
fpga开发·verilog·jesd204b·adrv9009
刀法自然12 天前
verilog实现n分频,n为奇数
fpga开发·verilog·分频器
雨洛lhw15 天前
vivado FFT IP 学习及仿真笔记
verilog·fft ip 核
brave and determined19 天前
可编程逻辑器件学习(day36):从沙粒到智能核心:芯片设计、制造与封装的万字全景解析
fpga开发·制造·verilog·fpga·芯片设计·硬件设计·芯片制造
云雾J视界20 天前
AI芯片设计实战:用Verilog高级综合技术优化神经网络加速器功耗与性能
深度学习·神经网络·verilog·nvidia·ai芯片·卷积加速器
brave and determined21 天前
可编程逻辑器件学习(day34):半导体编年史:从法拉第的意外发现到塑造现代文明的硅基浪潮
人工智能·深度学习·fpga开发·verilog·fpga·设计规范·嵌入式设计
stay_cloud22 天前
《Verilog语言与FPGA实现》课程实验
verilog·fpga·数码管
IC_Brother22 天前
数字IC经典电路(6)—Ring Oscillator(环形振荡器)与工艺角监控
verilog·数字ic·dc综合
brave and determined23 天前
可编程逻辑器件学习(day30):数字电路设计中的流水线技术:原理、实现与优化
学习·fpga开发·verilog·fpga·数字电路·硬件设计·嵌入式设计