当前位置:网站首页>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
边栏推荐
- VHDL语言实现32位二进制数转BCD码
- Source code and update details of new instance segmentation network panet (path aggregation network for instance segmentation)
- Now is the best time to empower industrial visual inspection with AI
- [latex] differences in the way scores are written
- 单极性非归零NRZ码、双极性非归零NRZ码、2ASK、2FSK、2PSK、2DPSK及MATLAB仿真
- Machine translation baseline
- Nel ASA: her ø Ya facility in Norway officially opened
- QT program integration easyplayer RTSP streaming media player screen flicker what is the reason?
- Paddlepaddle model to onnx
- [AI vision · quick review of today's sound acoustic papers issue 1] Thu, 14 APR 2022
猜你喜欢

ROS series (IV): ROS communication mechanism series (2): Service Communication
![[AI vision · quick review of NLP natural language processing papers today, issue 28] wed, 1 Dec 2021](/img/e1/ffa8c06b0856e16236b4c5ded882d7.png)
[AI vision · quick review of NLP natural language processing papers today, issue 28] wed, 1 Dec 2021

【Echart】echart 入门

Key point detection of human hand based on mediapipe

阿里云IoT流转到postgresql数据库方案

知乎有问题,谁来解答?

A function second kill 2sum 3sum 4sum problem

网络原理 | TCP/IP中的连接管理机制 重要协议与核心机制

matlab讀取多張fig圖然後合並為一張圖(子圖的形式)

秒杀所有区间相关问题
随机推荐
[latex] differences in the way scores are written
[mapping program design] coordinate azimuth calculation artifact (version C)
单片机串口数据处理(1)——串口中断发送数据
[mathematical modeling] my mathematical memory
TreeSet课后练习
The latest price trend chart and trading points of London Silver
[AI vision · quick review of robot papers today, issue 30] Thu, 14 APR 2022
Writing latex with vscode - the latest tutorial 2022 / 4 / 17
ROS series (IV): ROS communication mechanism series (1): topic communication
Win10 boot VMware virtual machine boot seconds blue screen problem perfect solution
Vscode download and installation + running C language
Install PaddlePaddle on ARM
【Echart】echart 入门
C language character constant
ROS series (II): ROS quick experience, taking HelloWorld program as an example
Raspberry pie 3B logs into the wired end of Ruijie campus network through mentohust, creates WiFi (open hotspot) for other devices, and realizes self startup at the same time
PHP export excel table
Photoshop installation under win10
[mapping program design] coordinate inverse artifact v1 0 (with C / C / VB source program)
A sword is a sword. There is no difference between a wooden sword and a copper sword