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
        http://bbs.vibesic.com/images/smilies/default/smile.gif
就是这样了。。呵呵

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; out;<br>
input&nbsp; &nbsp;&nbsp; &nbsp; 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 2 [3]
查看完整版本: 代码最简单的3-8译码器