Verilog编程以及Robei软件的安装

一、Verilog编程练习

1.1 门电路

1.1.1 两个门

module top_module (
    input in1,
    input in2,
    input in3,
    output out);

在这里插入图片描述
1.1.2 多逻辑门

module top_module( 
    input a, b,
    output out_and,
    output out_or,
    output out_xor,
    output out_nand,
    output out_nor,
    output out_xnor,
    output out_anotb
);

在这里插入图片描述

1.1.3 与门

module top_module( 
    input a, 
    input b, 
    output out );
	assign out=a&b;
endmodule

在这里插入图片描述

1.2 组合电路

1.2.1 2 1多用复合电路

module top_module( 
    input a, b, sel,
    output out ); 

endmodule

在这里插入图片描述
1.2.2 21总线多路复用器

module top_module( 
    input [99:0] a, b,
    input sel,
    output [99:0] out );

endmodule

在这里插入图片描述
1.2.3 91多路复用器

module top_module( 
    input [15:0] a, b, c, d, e, f, g, h, i,
    input [3:0] sel,
    output [15:0] out );

endmodule

在这里插入图片描述

1.3 时序电路

1.3.1 D触发

module top_module (
    input clk,    // Clocks are used in sequential circuits
    input d,
    output reg q );//

    // Use a clocked always block
    //   copy d to q at every positive edge of clk
    //   Clocked always blocks should use non-blocking assignments

endmodule

在这里插入图片描述
1.3.2 D锁存

module top_module (
    input d, 
    input ena,
    output q);

endmodule

在这里插入图片描述
1.3.3 四位二进制计数器

module top_module (
    input clk,
    input reset,      // Synchronous active-high reset
    output [3:0] q);

endmodule

在这里插入图片描述

二、Robei软件安装

2.1 安装准备

2.1.1 下载地址
2.1.2 一直点next就行了。
2.1.3 注册(可以不搞)

2.2 初次使用

2.2.1 主界面
在这里插入图片描述
2.2.2 Robei三元素

  • 模块:
    模块是设计流程中的基本元素,可以看作一个黑盒子。用于存放设计好的模型和输入实现模块功能的算法代码以及引脚信息。
  • 引脚:
    引脚是模块的门户,是模块与外界通信的接口。包括输入与输出两种类型。
  • 连接线:
    连接线是用来连接两个引脚,负责信号的传输。
    2.2.3 与门设计
    原理:
    在这里插入图片描述

直接进入正题,新建文件
在这里插入图片描述
属性设置:当点击了引脚之后右侧会弹出引脚属性栏。
在这里插入图片描述
输入代码:assign y = a & b;
在这里插入图片描述
保存:点击保存选择文件保存位置

注意:

  1. 保存的路径中不能含有中文和空格
  2. 保存文件名不能以数字和特殊字符开头
  3. 相关的文件要保存在同一路径下
  4. 保存的文件名会显示成当前设计的模块名称
  5. 命名时不能命名成 verilog 的关键字,如“module”,“if” 等
    在这里插入图片描述
    2.2.4 测试文件设计
    新建一个文件命名为andtest,和上面一个项目放在一起。
    在这里插入图片描述
    点击左边current中的模组,添加到andtest中(我把first重新命名为andgate)了,连线,输入代码。
    在这里插入图片描述开始仿真,这里编译可能会有几个错误:
    可参照下图改正:
    在这里插入图片描述
    在这里插入图片描述
    最后得到仿真波形
    在这里插入图片描述

三、资料引用

7天学会Robei.pdf
提取码:uxru
HDLBits — Verilog Practice
HDLBits 中文导学

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值