1.描述电路图里面的一个子模块


Assume that you want to implement hierarchical Verilog code for this circuit,
using three instantiations of a submodule that has a flip-flop and multiplexer in it.
Write a Verilog module (containing one flip-flop and multiplexer) named top_module for this submodule.
module dff(
input clk,
input q_in,
input L,
input r_in,
output reg Q
);
wire data;
always @(posedge clk) begin
Q <= data;
end
assign data = L ? r_in:q_in; endmodule

2.例化子模块


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.
```C //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 Q_0; mt2015_muxdff mt2015_muxdff_ins0(
.clk(KEY[0]),
.L(KEY[1]),
.q_in(LEDR[2]),
.r_in(SW[0]),
.Q(LEDR[0])
); mt2015_muxdff mt2015_muxdff_ins1(
.clk(KEY[0]),
.L(KEY[1]),
.q_in(LEDR[0]),
.r_in(SW[1]),
.Q(LEDR[1])
); mt2015_muxdff mt2015_muxdff_ins2(
.clk(KEY[0]),
.L(KEY[1]),
.q_in(LEDR[1]^LEDR[2]),
.r_in(SW[2]),
.Q(LEDR[2])
);
endmodule module mt2015_muxdff(
input clk,
input q_in,
input L,
input r_in,
output reg Q
);
wire data;
always @(posedge clk) begin
Q <= data;
end
assign data = L ? r_in:q_in;
endmodule

RTL原理图



最新文章

  1. rewrite规则中参数多于9个的处理方式 apache nginx
  2. 简单几句话总结Unicode,UTF-8和UTF-16
  3. 艺术品照片融合到背景墙上效果及DEMO
  4. IT公司100题-10-翻转句子中单词的顺序
  5. php的数组与数据结构
  6. 【Hades】ades是一个开源库,基于JPA和Spring构建,通过减少开发工作量显著的改进了数据访问层的实现
  7. Python:变量与字符串
  8. 转:jQuery事件绑定.on()简要概述及应用
  9. 基于Apache搭建Nagios图形监控
  10. Android Studio 合并分支代码到主干的操作总结
  11. go 终端读写、文件读写
  12. 转 G1垃圾收集器入门
  13. JSP基础知识➣客户端请求与服务端响应(三)
  14. Top useful .Net extension methods
  15. C# winform程序防止前台卡死
  16. 关于NLB的群集操作模式知识 (转载)
  17. China Internet Conference(2018.07.12)
  18. Asp.Net Core WebAPI入门整理(二)简单示例
  19. WPF Out Of Memory
  20. Mac编译安装swfTools

热门文章

  1. 04-python垃圾回收机制
  2. VUE学习-渲染函数
  3. Dockerfile自定义镜像
  4. TPS,RPS,QPS,RT的区别
  5. Qt头文件引用其他类,主类头文件报错(1)invalid use of incomplete type &#39;class xx::yy&#39; (2)forward declaration of &#39;class xx::yy&#39;
  6. mysql8改密码
  7. idea字体的大小设置
  8. git+jenkins+ansible+gitlab部署网站
  9. 冒泡排序快速排序C语言
  10. Jmeter学习:插件