当前位置:网站首页>[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 ...
边栏推荐
- Play with grpc - communication between different programming languages
- That hard-working student failed the college entrance examination... Don't panic! You have another chance to counter attack!
- SWT/ANR问题--当发送ANR/SWT时候如何打开binder trace(BinderTraces)
- 日志中打印统计信息的方案
- Basic operation of queue (implemented in C language)
- 【R语言数据科学】:机器学习常见评估指标
- el-form-item 正则验证
- [R language data science]: common evaluation indicators of machine learning
- Use the npoi package of net core 6 C to read excel Pictures in xlsx cells and stored to the specified server
- Tdengine connector goes online Google Data Studio app store
猜你喜欢

【修复版】仿我爱看电影网站模板/海洋CMS影视系统模板

sqlilabs less-11~12

【牛客网刷题系列 之 Verilog快速入门】~ 多功能数据处理器、求两个数的差值、使用generate…for语句简化代码、使用子模块实现三输入数的大小比较

Summary of leetcode's dynamic programming 5

Scheme of printing statistical information in log

2022 PMP project management examination agile knowledge points (6)

被裁三個月,面試到處碰壁,心態已經開始崩了

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

【R语言数据科学】:机器学习常见评估指标

Six years of technology iteration, challenges and exploration of Alibaba's globalization and compliance
随机推荐
Après avoir été licencié pendant trois mois, l'entrevue s'est effondrée et l'état d'esprit a commencé à s'effondrer.
Research Report on the development trend and competitive strategy of the global commercial glassware industry
[repair version] imitating the template of I love watching movies website / template of ocean CMS film and television system
643. Maximum average number of subarrays I
Research Report on the development trend and competitive strategy of the global navigation simulator industry
How to view the state-owned enterprises have unloaded Microsoft office and switched to Kingsoft WPS?
sqlilabs less9
微服务大行其道的今天,Service Mesh是怎样一种存在?
Introduction to distributed transactions (Seata)
Use of Oracle database objects
SWT / anr problem - how to capture performance trace
开源实习经验分享:openEuler软件包加固测试
Research Report on the development trend and competitive strategy of the global indexable milling cutter industry
Don't want to knock the code? Here comes the chance
241. 为运算表达式设计优先级
【IoT毕设.上】STM32+机智云AIoT+实验室安全监控系统
MySQL log
Error:Kotlin: Module was compiled with an incompatible version of Kotlin. The binary version of its
Guess lantern riddles, not programmers still can't understand?
Vnctf2022 open web gocalc0