当前位置:网站首页>【牛客网刷题系列 之 Verilog快速入门】~ 使用函数实现数据大小端转换
【牛客网刷题系列 之 Verilog快速入门】~ 使用函数实现数据大小端转换
2022-07-01 14:18:00 【AI很不错呦】
目录:
0. 前言
0.1 知识点考察
考察的是:
- 函数function的知识点;
- 理解大端小端。传送门
0.2 知识拓展
function和task的定义和区别?
这个问题之前总结过,直接老规矩,插眼,传送门
1. VL10 使用函数实现数据大小端转换
1.1 题目描述
在数字芯片设计中,经常把实现特定功能的模块编写成函数,在需要的时候再在主模块中调用,以提高代码的复用性和提高设计的层次,分别后续的修改。
请用函数实现一个4bit数据大小端转换的功能。实现对两个不同的输入分别转换并输出。
1.1.1 信号示意图

1.1.2 波形示意图
该题官方没有给出。
1.1.3 输入描述
clk:系统时钟
rst_n:异步复位信号,低电平有效
a,b:4bit位宽的无符号数
(注意的是:官方代码并没有声明clk和rst_n,小伙伴们提交的时候注意自己加一下!!!)
1.1.4 输出描述
c,d:4bit位宽的无符号数
(这里应该是官方笔误,是四位的就对了)
1.2 解题思路
主要还是考察function的细节点,题目本身不难,就是大端小端进行转换。这些知识点在本篇文章的前言部分已经有说明了,自行查看。
1.3 代码实现
`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 测试文件
待更。。。
1.5 仿真波形
待更。。。
边栏推荐
- Research Report on the development trend and competitive strategy of the global indexable milling cutter industry
- 【修复版】仿我爱看电影网站模板/海洋CMS影视系统模板
- What "hard core innovations" does Intel have in the first half of 2022? Just look at this picture!
- Provincial election + noi Part IX game theory
- 光环效应——谁说头上有光的就算英雄
- "National defense seven sons" funding soared, with Tsinghua reaching 36.2 billion yuan, ranking second with 10.1 billion yuan. The 2022 budget of national colleges and universities was made public
- 原来程序员搞私活这么赚钱?真的太香了
- sqlilabs less9
- 建立自己的网站(21)
- Research Report on the development trend and competitive strategy of the global facial wrinkle removal and beauty instrument industry
猜你喜欢

Animesr: learnable degradation operator and new real world animation VSR dataset

Six years of technology iteration, challenges and exploration of Alibaba's globalization and compliance

Admire, Ali female program undercover more than 500 black production groups

Basis of target detection (NMS)

TDengine 连接器上线 Google Data Studio 应用商店

App automation testing Kaiyuan platform appium runner

2022 PMP project management examination agile knowledge points (6)
![[repair version] imitating the template of I love watching movies website / template of ocean CMS film and television system](/img/fa/15b1cc3a8a723ff34eb457af9f701e.jpg)
[repair version] imitating the template of I love watching movies website / template of ocean CMS film and television system

sqlilabs less10

QT community management system
随机推荐
"National defense seven sons" funding soared, with Tsinghua reaching 36.2 billion yuan, ranking second with 10.1 billion yuan. The 2022 budget of national colleges and universities was made public
MySQL日志
Research Report on the development trend and competitive strategy of the global navigation simulator industry
使用CMD修复和恢复病毒感染文件
开源实习经验分享:openEuler软件包加固测试
sqlilabs less-11~12
Sorting learning sorting
Research Report on the development trend and competitive strategy of the global facial wrinkle removal and beauty instrument industry
What class loading mechanisms does the JVM have?
[repair version] imitating the template of I love watching movies website / template of ocean CMS film and television system
原来程序员搞私活这么赚钱?真的太香了
Applet - multiple text line breaks in view
SWT/ANR问题--如何捕获性能的trace
【修复版】仿我爱看电影网站模板/海洋CMS影视系统模板
Research Report on the development trend and competitive strategy of the global pipeline robot inspection camera industry
2022. Let me take you from getting started to mastering jetpack architecture components - lifecycle
8 best practices to protect your IAC security!
App automation testing Kaiyuan platform appium runner
That hard-working student failed the college entrance examination... Don't panic! You have another chance to counter attack!
小程序-小程序图表库(F2图表库)