当前位置:网站首页>[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 ...
边栏推荐
- That hard-working student failed the college entrance examination... Don't panic! You have another chance to counter attack!
- 既不是研发顶尖高手,也不是销售大牛,为何偏偏获得 2 万 RMB 的首个涛思文化奖?
- El form item regular verification
- Distributed dynamic (collaborative) rendering / function runtime based on computing power driven, data and function collaboration
- SWT/ANR问题--如何捕获性能的trace
- 我们该如何保护自己的密码?
- Leetcode(69)——x 的平方根
- sqlilabs less10
- 队列的基本操作(C语言实现)
- sqlilabs less9
猜你喜欢

数据湖系列之一 | 你一定爱读的极简数据平台史,从数据仓库、数据湖到湖仓一体

After being laid off for three months, the interview ran into a wall everywhere, and the mentality has begun to collapse

Oracle-数据库对象的使用

【商业终端仿真解决方案】上海道宁为您带来Georgia介绍、试用、教程

2022. Let me take you from getting started to mastering jetpack architecture components - lifecycle

How will the surging tide of digitalization overturn the future?

如何看待国企纷纷卸载微软Office改用金山WPS?

建立自己的网站(21)

用栈实现队列、用队列实现栈(C语言_leetcode_232+225)
![[dynamic programming] interval dp:p1005 matrix retrieval](/img/c9/2091f51b905d2c0ebc978dab3d34d3.jpg)
[dynamic programming] interval dp:p1005 matrix retrieval
随机推荐
Effet halo - qui dit qu'il y a de la lumière sur la tête est un héros
Provincial election + noi Part IX game theory
Play with grpc - communication between different programming languages
C 语言进阶
如何看待国企纷纷卸载微软Office改用金山WPS?
TexStudio使用教程
【修复版】仿我爱看电影网站模板/海洋CMS影视系统模板
Research Report on the development trend and competitive strategy of the global electromagnetic flowmeter industry
2022. Let me take you from getting started to mastering jetpack architecture components - lifecycle
Leetcode (69) -- square root of X
Go整合Logrus实现日志打印
Force deduction solution summary 241- design priority for operation expression
Open source internship experience sharing: openeuler software package reinforcement test
8 best practices to protect your IAC security!
Research Report on development trend and competitive strategy of global consumer glassware industry
Use the npoi package of net core 6 C to read excel Pictures in xlsx cells and stored to the specified server
MySQL日志
Introduction to distributed transactions (Seata)
Research Report on the development trend and competitive strategy of the global facial wrinkle removal and beauty instrument industry
C language ordering management system