当前位置:网站首页>VHDL implementation of 32-bit binary to BCD code
VHDL implementation of 32-bit binary to BCD code
2022-04-23 04:00:00 【Chenxr32】
Use FPGA The nixie tube on the development board displays the value , You need to convert the value to the corresponding BCD code , Then the value is displayed on the nixie tube through the seven segment decoder . I divide by ten , use VHDL Yes 32 Bit binary conversion BCD Code code .
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
USE IEEE.STD_LOGIC_ARITH.ALL;
ENTITY BIN32_TO_BCD1 IS
PORT(
BIN: IN STD_LOGIC_VECTOR(31 DOWNTO 0);
BCD: OUT STD_LOGIC_VECTOR(39 DOWNTO 0)
);
END ENTITY BIN32_TO_BCD1;
ARCHITECTURE RTL OF BIN32_TO_BCD1 IS
BEGIN
PROCESS(BIN)
VARIABLE TEMP: INTEGER;
VARIABLE BIN_TEMP: INTEGER;
VARIABLE BCD_TEMP: STD_LOGIC_VECTOR(39 DOWNTO 0);
BEGIN
BCD_TEMP:=X"0000000000";
BIN_TEMP:=CONV_INTEGER(BIN);
FOR K IN 0 TO 9 LOOP
TEMP:=BIN_TEMP REM 10;
BCD_TEMP(3+4*K DOWNTO K*4):=CONV_STD_LOGIC_VECTOR(TEMP,4);
BIN_TEMP:=(BIN_TEMP-TEMP)/10;
IF BIN_TEMP=0 THEN
EXIT;
END IF;
END LOOP;
BCD<=BCD_TEMP;
END PROCESS;
END RTL;
I wanted to add it by moving left 3 The algorithm of , But it didn't work . The above method of dividing by ten is to divide STD_LOGIC_VECTOR convert to INTEGER, Then divide by ten and take the remainder and propose decimal places one by one . Be limited to VHDL Of INTEGER Is a signed integer , The above code can only realize 31 Bit unsigned binary to BCD code .
版权声明
本文为[Chenxr32]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230356325358.html
边栏推荐
- Basic knowledge of convolutional neural network
- [latex] formula group
- php导出Excel表格
- 现货黄金基本介绍
- 伦敦银最新价格走势图与买卖点
- [mapping program design] coordinate azimuth calculation artifact (version C)
- C语言 字符常量
- Qtspim manual - Chinese Translation
- Process seven state transition diagram
- Source code and update details of new instance segmentation network panet (path aggregation network for instance segmentation)
猜你喜欢

Overview of knowledge map (II)

Abstract classes, interfaces and common keywords

【ICCV 2019】MAP-VAE:Multi-Angle Point Cloud-VAE: Unsupervised Feature Learning for 3D Point Clouds..

How Zotero quotes in word jump to references / hyperlink

Concepts of objects and classes

What if win10 doesn't have a local group policy?

matlab读取多张fig图然后合并为一张图(子图的形式)

Let matlab2018b support the mex configuration of vs2019

Xiaomi, qui a établi le plus grand volume de ventes de téléphones portables domestiques sur le marché d'outre - mer, se concentre de nouveau sur le marché intérieur

LabVIEW 小端序和大端序区别
随机推荐
LabVIEW 小端序和大端序区别
Express middleware ① (use of Middleware)
基于PHP的代步工具购物商城
【ICCV 2019】MAP-VAE:Multi-Angle Point Cloud-VAE: Unsupervised Feature Learning for 3D Point Clouds..
RuntimeError: output with shape [4, 1, 512, 512] doesn‘t match the broadcast shape[4, 4, 512, 512]
Machine translation baseline
Vscode delete uninstall residue
【Echart】echart 入门
Concepts of objects and classes
秒杀所有区间相关问题
Digital image processing third edition Gonzalez notes Chapter 2
[Li Hongyi 2022 machine learning spring] hw6_ Gan (don't understand...)
中国移动日赚2.85亿很高?其实是5G难带来更多利润,那么钱去哪里了?
ROS series (V): common commands in ROS
AI CC 2019 installation tutorial under win10 (super detailed - small white version)
ROS series (I): rapid installation of ROS
Basic introduction to spot gold
【NeurIPS 2019】Self-Supervised Deep Learning on Point Clouds by Reconstructing Space
CRF based medical entity recognition baseline
[mapping program design] coordinate azimuth calculation artifact (version C)