当前位置:网站首页>【牛客网刷题系列 之 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 仿真波形
待更。。。
边栏推荐
- Provincial election + noi Part XI others
- [Jianzhi offer] 55 - ii balanced binary tree
- 佩服,阿里女程序卧底 500 多个黑产群……
- Research Report on the development trend and competitive strategy of the global indexable milling cutter industry
- Enter the top six! Boyun's sales ranking in China's cloud management software market continues to rise
- C语言订餐管理系统
- 【修复版】仿我爱看电影网站模板/海洋CMS影视系统模板
- [R language data science]: common evaluation indicators of machine learning
- 力扣解法汇总241-为运算表达式设计优先级
- Etcd 概要 机制 和使用场景
猜你喜欢

Scheme of printing statistical information in log

Use lambda function URL + cloudfront to realize S3 image back to source

使用CMD修复和恢复病毒感染文件

QT社团管理系统

“国防七子”经费暴增,清华足足362亿元,甩第二名101亿 |全国高校2022预算大公开...

Learning to use livedata and ViewModel will make it easier for you to write business

Use of Oracle database objects
![[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

Understand the window query function of tdengine in one article

Error:Kotlin: Module was compiled with an incompatible version of Kotlin. The binary version of its
随机推荐
TDengine 连接器上线 Google Data Studio 应用商店
SWT / anr problem - how to open binder trace (bindertraces) when sending anr / SWT
After being laid off for three months, the interview ran into a wall everywhere, and the mentality has begun to collapse
百度上找的期货公司安全吗?期货公司怎么确定正规
Basic operation of queue (implemented in C language)
用栈实现队列、用队列实现栈(C语言_leetcode_232+225)
光环效应——谁说头上有光的就算英雄
Error:Kotlin: Module was compiled with an incompatible version of Kotlin. The binary version of its
【 剑指 Offer】55 - I. 二叉树的深度
被裁三个月,面试到处碰壁,心态已经开始崩了
Use of Oracle database objects
【IoT毕设.上】STM32+机智云AIoT+实验室安全监控系统
【修复版】仿我爱看电影网站模板/海洋CMS影视系统模板
Animesr: learnable degradation operator and new real world animation VSR dataset
玩转MongoDB—搭建MongoDB集群
程序设计的基本概念
既不是研发顶尖高手,也不是销售大牛,为何偏偏获得 2 万 RMB 的首个涛思文化奖?
分布式事务简介(seata)
微服务大行其道的今天,Service Mesh是怎样一种存在?
So programmers make so much money doing private work? It's really delicious