【HDLBits】verilog在线编程练习

一、前言

HDLBits是一个很棒的 Verilog 学习网站。
HDLBits 在提供 Verilog 基础语法教程的同时,还能够在线仿真你的 Verilog 模块,将你的输出与正确的时序比较。
可以让初学者在快速上手的同时,也更直观的感受到这门语言的特殊之处
下面是传送门:
HDLBits

二、组合逻辑相关练习

1.2 多路复用器

问题描述:

Create a one-bit wide, 2-to-1 multiplexer. When sel=0, choose a. When sel=1, choose b.

代码:

module top_module( 
    input a, b, sel,
    output out ); 
     assign out = (sel) ? b : a;

endmodule

仿真结果:
在这里插入图片描述

1.2 全加器

问题描述:

Create a full adder. A full adder adds three bits (including carry-in) and produces a sum and carry-out.

代码:

module top_module( 
    input a, b, cin,
    output cout, sum );
    assign{
   cout,sum} = a + b + cin;
endmodule

在这里插入图片描述

1.3 卡诺图

问题描述:

Consider the function f shown in the Karnaugh map below.

在这里插入图片描述

Implement this function. d is don’t-care, which means you may choose
to output whatever value is convenient.

代码:

module top_module (
    input [4:1] x, 
    output f );
    assign f =<
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值