vhdl设计
8-3编码器的设计实例
编码器设计方案之一:
mole encoder1(none_on,out,in);
output none_on;
output [2:0] out;
input [7:0] in;
reg [2:0] out;
reg none_on;
always @(in)
begin: local
integer i;
out = 0;
none_on = 1;
/*returns the value of the highest bit
number turned on*/
for( i=0; i<8; i=i+1 )
begin
if( in[i] )
begin
out = i;
none_on = 0;
end
end
end
endmole
编码器设计方案之二:
mole encoder2 ( none_on, out2, out1, out0, h, g, f,
e, d, c, b, a);
input h, g, f, e, d, c, b, a;
output none_on, out2, out1, out0;
wire [3:0] outvec;
assign outvec= h? 4'b0111 : g? 4'b0110 : f? 4'b0101:
e? 4'b0100 : d? 4'b0011 :c? 4'b0010 : b? 4'b0001:
a? 4'b0000 : 4'b1000;
assign none_on = outvec[3];
assign out2 = outvec[2];
assign out1 = outvec[1];
assign out0 = outvec[0];
endmole
编码器设计方案之三:
mole encoder3 (none_on, out2, out1, out0, h, g,
f, e, d, c, b, a);
input h, g, f, e, d, c, b, a;
output out2, out1, out0;
output none_on;
reg [3:0] outvec;
assign {none_on,out2,out1,out0} = outvec;
always @( a or b or c or d or e or f or g or h)
begin
if(h) outvec=4'b0111;
else if(g) outvec=4'b0110;
else if(f) outvec=4'b0101;
else if(e) outvec=4'b0100;
else if(d) outvec=4'b0011;
else if(c) outvec=4'b0010;
else if(b) outvec=4'b0001;
else if(a) outvec=4'b0000;
else outvec=4'b1000;
end
endmole
『贰』 VHDL设计用什么软件
设计软件常用的无非是 ISE 和 quartus ,具体要用哪个是根据你所使用的器件决定的,比如你用Altera的器件你就要用quartus和nios。
『叁』 vhdl的简单alu设计
额,再设计之前首先要了解ALU的特性,最重要的一个特性就是选择性回执行运算,即时说一次执行答一个选择的运算。
所以再看楼主的程序,使用的是多个并行的PROCESS来实现,这种方法我觉得就有问题,并且用两个运算单位X和Y来作为RPOCESS的敏感变量就更有问题了。。。最重要的是要记住,ALU执行的不是顺序逻辑,而是组合逻辑,所以不要加PROCESS,因为加了PROCESS就引入了时间的概念,就成了顺序逻辑了。
我把我写的一个ALU发到楼主邮箱了,是VHD文件,这个ALU可以实现9种运算,当然也包括加减乘除,其余的是一些逻辑运算,楼主也可以看看,这个ALU是完美运行,并且我GENERIC了一个变量来控制运算的位数,程序里我我取得是4位,楼主可以根据自己需求来改
PS:你的邮箱是不是打错了啊。。。应该是352016927吧。。。我说怎么一直发送失败。。。
好了,呵呵,说了这么多,希望对你有所帮助啊
『肆』 VHDL设计
楼主的意思比较简单 是两道题吧?
1,代码
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity ornot3 is
port( a0,a1,a2 :in std_logic; ---3 inputs
y:out std_logic --- output
);
end entity ornot3;
architecture arc of ornot3 is
begin
process(a0,a1,a2)
begin
y<= not(a0 or a1 or a2);
end process;
end arc;
2.代码
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity sel2 is
port( sel :in std_logic; ---3 inputs
a0,a1: in std_logic_vector(3 downto 0);
y:out std_logic_vector(3 downto 0) --- output
);
end entity sel2;
architecture arc of sel2 is
begin
process(a0,a1,sel)
begin
if sel = '0'then
y <= a0;
elsif sel = '1' then
y <= a1;
else y <= "ZZZZ";
end if;
end process;
end arc;
『伍』 用vhdl设计四输入与门,两种方法
第一种方法,程序如下:
library ieee;
use ieee.std_logic_1164.all;
entity and4 is
port (a,b,c,d : in std_logic;
z : out std_logic );
end and4;
architecture medied of and4 is
begin
z <= (a and b) and (c and d);
end medied;
第二种方法,程序如下:
library ieee;
use ieee.std_logic_1164.all;
entity and4 is
port (a,b,c,d : in std_logic;
z : out std_logic );
end and4;
architecture medied of and4 is
signal abcd : std_logic_vector(3 downto 0);
begin
abcd <= a&b&c&d;
process(abcd)
begin
case abcd is
when "1111" => Z <= '1';
when others => z <= '0';
end case;
end process;
end medied;
此外还有很多写法可以实现4输入与门这个功能。
这样的程序并不复杂,建议楼主多动手写写,不能总依赖别人,自己摸索出来的东西才印象深刻。
希望你认真学习,学有所成。
『陆』 VHDL简单计算器设计
先算一下1+1=0,进1
1+0=1,进0
0+1=1,进0
0+0=0,进0
减法也是。然后用二进制与门,非门啥的拼一内下。VHDL没学过,数字电容路总会吧。通过二进制表示十进制数。就像1010B=10D。
然后就组织成C语言的样子。用IF就能完成。这个直接用十进制计算就行了。实体上看你怎么输入了,是直接十进制输入呢?还是二进制输入呢?二进制输入的话,结构体里还要做个换算。
『柒』 用VHDL设计一个八选一电路
LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
ENTITY div_8 IS
PORT( clk:IN std_logic;
y:OUT std_logic);
END;
ARCHITECTURE bhv OF div_8 IS
SIGNAL d,q:std_logic_vector(2 DOWNTO 0);
BEGIN
d <= NOT q;
PROCESS(clk)
BEGIN
IF rising_edge(clk) THEN
q(0) <= d(0);
END IF;
END PROCESS;
PROCESS(q(0))
BEGIN
IF rising_edge(q(0)) THEN
q(1) <= d(1);
END IF;
END PROCESS;
PROCESS(q(1))
BEGIN
IF rising_edge(q(1)) THEN
q(2) <= d(2);
END IF;
END PROCESS;
y <= q(2);
END bhv;
『捌』 VHDL程序设计
完成100计数器的设计,计数值范围0~99(二进制 0000000~1100011,注意宽度7比特);并进行120个周期以上的波形仿真。
『玖』 设计vhdl语言用哪个软件啊
常用的编译环境有Altera公司的Quartus和Xilinx公司的ISE两款软件。当然编译环境你可以选择notepad++或者Vi编辑工具。
『拾』 vhdl设计程序~
iouiuiuooiu