集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
123
返回列表 发新帖
楼主: longtim

代码最简单的3-8译码器

[复制链接]
CHA 发表于 2010-6-27 00:43:09 | 显示全部楼层
同意#11的见解,先对output所有位赋值,再对output相应位赋值
AAT 发表于 2010-6-27 00:58:11 | 显示全部楼层
学习印度的软件规范
AAT 发表于 2010-6-27 02:28:52 | 显示全部楼层
原帖由 hwlyic 于 2006-7-30 03:56 发表<br>
在verilog中可以 这样写<br>
<br>
always @(*) begin<br>
&nbsp; &nbsp;&nbsp; &nbsp; output = 8'b0;<br>
&nbsp; &nbsp;&nbsp; &nbsp; output = 1'b1;<br>
end
       
就是这样了。。呵呵
CHAN 发表于 2010-6-27 02:39:22 | 显示全部楼层
原帖由 skycanny 于 2006-7-29 11:36 发表<br>
这个似乎有问题吧,请楼主给解释一下! library IEEE;<br>
use IEEE.std_logic_1164.all;<br>
use IEEE.std_logic_unsigned.all;<br>
<br>
entity trans38 is<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;port(<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; input : in std_logic_vector(2 downto 0);<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; output : out std_logic_vector(7 downto 0)<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;);<br>
end entity trans38;<br>
<br>
<br>
architecture behav of trans38 is<br>
begin<br>
process(input)<br>
begin<br>
output&lt;=(others=&gt;'0');<br>
output(conv_integer(input))&lt;='1';<br>
end process;<br>
end architecture behav; <br>
<br>
<br>
这样就差不多了,这个程序还是很不错的<br>
<br>
占用8LCs 也还是可以接受的
HDL 发表于 2010-6-27 02:41:46 | 显示全部楼层
用VORILOG更简单吧<br>
module decoder(out,in);<br>
output&nbsp; &nbsp; [7:0]out;<br>
input&nbsp; &nbsp;&nbsp; &nbsp; [2:0]in;<br>
&nbsp;&nbsp;assign&nbsp;&nbsp;out=1'b1&lt;&lt;in;<br>
endmodule
CCIE 发表于 2010-6-27 03:35:55 | 显示全部楼层
我把名字取错了哈 <br>
output&lt;=(conv_integer(input))&lt;='1';这句话的意思是把输入转化为整数<br>
使对应的那一位变成1&nbsp; &nbsp; 比如INPUT是010&nbsp; &nbsp;转化为2 则OUTPUT为00000100<br>
也就是OUTPUT的第2位为1
ngtim 发表于 2010-6-27 04:29:19 | 显示全部楼层
output&lt;=(others=&gt;0);<br>
<br>
应该是&nbsp; &nbsp;output&lt;=(others=&gt;'0');&nbsp;&nbsp;吧?<br>
<br>
output&lt;=(conv_integer(input))&lt;='1';&nbsp;&nbsp;这句怎么理解?
usb 发表于 2010-6-27 04:53:31 | 显示全部楼层
原帖由 wolfie 于 2006-8-1 01:16 发表<br>
<br>
<br>
library IEEE;<br>
use IEEE.std_logic_1164.all;<br>
use IEEE.std_logic_unsigned.all;<br>
<br>
entity trans38 is<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;port(<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; input : in std_logic_vector(2 downto 0);<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; outp ... 这就差不多了,但是编译综合时软件会提示警告吧
CTT 发表于 2010-6-27 05:03:08 | 显示全部楼层
兄弟们,我们导师要求我们编写模块时追求的不是简洁,而是功耗和面积
Sunlife 发表于 2015-6-25 11:07:10 | 显示全部楼层

硬件描述语言不像C语言,它的关键不在代码写的如何的简洁,如何能够提高速度,减少面积,降低功耗。
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

QQ|小黑屋|手机版|Archiver|fpga论坛|fpga设计论坛 ( 京ICP备20003123号-1 )

GMT+8, 2025-5-6 18:09 , Processed in 0.065513 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表