当前位置:网站首页>[Verilog quick start of Niuke question series] ~ use functions to realize data size conversion
[Verilog quick start of Niuke question series] ~ use functions to realize data size conversion
2022-07-01 14:25:00 【AI is very good】
0. Preface
0.1 Knowledge point investigation
The investigation is :
- function function Knowledge points of ;
- Understand big end and small end . Portal
0.2 Knowledge development
function and task The definition and difference of ?
This problem has been summarized before , Direct old rules , Poke an eye , Portal
1. VL10 Use function to realize data size conversion
1.1 Title Description
In digital chip design , Modules that implement specific functions are often written as function , Call again in the middle note module when needed. , In order to improve the reusability of code and improve the level of design , Subsequent modifications are made separately .
Please implement a function 4bit Function of data size conversion . Realize the conversion and output of two different inputs respectively .
1.1.1 Signal schematic diagram

1.1.2 Waveform diagram
This question is not officially given .
1.1.3 Input description
clk: The system clock
rst_n: Asynchronous reset signal , Low level active
a,b:4bit Unsigned number of bits wide
( Pay attention to is : The official code does not state clk and rst_n, Pay attention to add it by yourself when submitting !!!)
1.1.4 Output description
c,d:4bit Unsigned number of bits wide
( This should be an official clerical error , Four is right )
1.2 Their thinking
The main thing is to investigate function Details of , The subject itself is not difficult , That is, the big end and the small end are converted . These knowledge points have been explained in the preface of this article , To view the .
1.3 Code implementation
`timescale 1ns/1ns
module function_mod(
input clk,
input rst_n,
input [3:0]a,
input [3:0]b,
output [3:0]c,
output [3:0]d
);
function [3:0] big22small;
input [3:0] big_small;
begin
big22small[0] = big_small[3];
big22small[1] = big_small[2];
big22small[2] = big_small[1];
big22small[3] = big_small[0];
end
endfunction
assign c = big22small(a);
assign d = big22small(b);
endmodule
1.4 The test file
To be changed ...
1.5 Simulation waveform
To be changed ...
边栏推荐
- [IOT completion. Part 2] stm32+ smart cloud aiot+ laboratory security monitoring system
- 如何看待国企纷纷卸载微软Office改用金山WPS?
- “国防七子”经费暴增,清华足足362亿元,甩第二名101亿 |全国高校2022预算大公开...
- C 语言进阶
- 【修复版】仿我爱看电影网站模板/海洋CMS影视系统模板
- MySQL log
- 使用net core 6 c# 的 NPOI 包,读取excel..xlsx单元格内的图片,并存储到指定服务器
- phpcms实现订单直接支付宝支付功能
- Research Report on development trend and competitive strategy of global consumer glassware industry
- Why did you win the first Taosi culture award of 20000 RMB if you are neither a top R & D expert nor a sales Daniel?
猜你喜欢

Summary of leetcode's dynamic programming 5
![[R language data science]: common evaluation indicators of machine learning](/img/c8/dbfb041fa72799fae1892fe8ac0050.png)
[R language data science]: common evaluation indicators of machine learning

玩转gRPC—不同编程语言间通信

241. 为运算表达式设计优先级

Use the right scene, get twice the result with half the effort! Full introduction to the window query function and usage scenarios of tdengine
![[commercial terminal simulation solution] Shanghai daoning brings you Georgia introduction, trial and tutorial](/img/44/b65aaf11b1e632f2dab55b6fc699f6.jpg)
[commercial terminal simulation solution] Shanghai daoning brings you Georgia introduction, trial and tutorial

phpcms实现订单直接支付宝支付功能

That hard-working student failed the college entrance examination... Don't panic! You have another chance to counter attack!

Sqlachemy common operations

2022. Let me take you from getting started to mastering jetpack architecture components - lifecycle
随机推荐
Leetcode(69)——x 的平方根
Research Report on development trend and competitive strategy of global vibration polishing machine industry
“国防七子”经费暴增,清华足足362亿元,甩第二名101亿 |全国高校2022预算大公开...
sqlilabs less-11~12
Open source internship experience sharing: openeuler software package reinforcement test
Fundamentals of C language
Error:Kotlin: Module was compiled with an incompatible version of Kotlin. The binary version of its
Use lambda function URL + cloudfront to realize S3 image back to source
241. 为运算表达式设计优先级
[R language data science]: common evaluation indicators of machine learning
How can we protect our passwords?
Phpcms realizes the direct Alipay payment function of orders
[NLP] pre training model - gpt1
Introduction to distributed transactions (Seata)
算网融合赋能行业转型,移动云点亮数智未来新路标
C 语言进阶
Six years of technology iteration, challenges and exploration of Alibaba's globalization and compliance
That hard-working student failed the college entrance examination... Don't panic! You have another chance to counter attack!
Realize queue with stack and stack with queue (C language \leetcode\u 232+225)
用对场景,事半功倍!TDengine 的窗口查询功能及使用场景全介绍