当前位置:网站首页>Mux256to1v,Hadd,Fadd
Mux256to1v,Hadd,Fadd
2022-07-17 10:21:00 【海派小甜心】
Create a 4-bit wide, 256-to-1 multiplexer. The 256 4-bit inputs are all packed into a single 1024-bit input vector. sel=0 should select bits in[3:0], sel=1 selects bits in[7:4], sel=2 selects bits in[11:8], etc.
有以下几种方法
module top_module(
input [1023:0] in,
input [7:0] sel,
output [3:0] out );
assign out = {in[sel*4+3], in[sel*4+2], in[sel*4+1], in[sel*4+0]};
endmodulemodule top_module(
input [1023:0] in,
input [7:0] sel,
output [3:0] out );
assign out = in[sel*4 +: 4];// 从 sel*4 开始,选择比特序号大于sel*4 的 4 位比特,相当于[sel*4+3:sel*4]
endmodulemodule top_module(
input [1023:0] in,
input [7:0] sel,
output [3:0] out );
assign out = in[sel*4+3 -: 4]; // 从 sel*4+3 开始,选择比特序号小于 sel*4+3 的 4 位比特,相当于[sel*4+3:sel*4]
endmoduleCreate a half adder. A half adder adds two bits (with no carry-in) and produces a sum and carry-out.
module top_module(
input a, b,
output cout, sum );
assign {cout,sum} = a + b;
endmodule
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
边栏推荐
- 第七天训练
- Case sharing | build a one-stop data development platform for hehe information based on linkis+dss
- ETCD数据库源码分析——etcdserver bootstrap从快照中恢复store
- Anycontrol demo demo demo
- 开发第一个Flink应用
- Target detection model size calculation, model complexity (parameter conversion formula)
- Flink小知识--任务调度slot的配置 slotSharingGroup
- OpenCV模板
- How to build your own cloud database in docker
- 焱融科技入选北京市 2022 年度“专精特新”,领航混合云文件存储
猜你喜欢

Flink small knowledge -- configuration of task scheduling slots slotsharinggroup

Case sharing | build a one-stop data development platform for hehe information based on linkis+dss

MySql数据是如何存储在磁盘上存储的?

C language compilation process

静态路由!!静态路由!!静态路由!!

案例分享 | 基于Linkis+DSS构建合合信息一站式数据开发平台

【排错必看】Windows系统安装mysql时常见问题及解决方法

565. 数组嵌套

Flink小知识--任务调度slot的配置 slotSharingGroup

岚图梦想家的产品力到底如何?
随机推荐
OLED显示如何理解 12*6、16*8、24*12等字符大小
Day 5 training
Development utility
Tree array
[Network Research Institute] the threat of machine learning system is time to take it seriously
C# 读写文本,生成二维码
OpenCV模板
如何正确执行Jedis单元测试
代码随想录:刷题记录(更新中)
Pytorch框架之优化器 Optimizer
Case sharing | build a one-stop data development platform for hehe information based on linkis+dss
【C语言】整形数据的存储
C语言力扣第25题之k个一组反转链表。多指针遍历
2022-07-16:以下go语言代码输出什么?A:[];B:[5];C:[5 0 0 0 0];D:[0 0 0 0 0]。 package main imp
how to use culasLt
MySql数据是如何存储在磁盘上存储的?
Anaconda与Jupyter Notebook入门级详细使用教程
Vector容器的系列操作( 详解 )
codeforces每日5题(均1500)-第十七天
OLED displays how to understand the character sizes of 12*6, 16*8, 24*12, etc