搜索
bottom↓
回复: 29

有没有一起学FPGA的

[复制链接]

出0入0汤圆

发表于 2012-1-13 22:39:31 | 显示全部楼层 |阅读模式
大家相互鼓励,从明天起开始学习FPGA,我用的xilinx的,不管是xilinx和altera我们可以一起交流,希望大神们多多指点

阿莫论坛20周年了!感谢大家的支持与爱护!!

知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)

出0入0汤圆

发表于 2012-1-13 23:33:48 | 显示全部楼层
我也在学!

出0入25汤圆

发表于 2012-1-13 23:48:00 | 显示全部楼层
算我一个

出0入0汤圆

发表于 2012-1-13 23:49:00 | 显示全部楼层
正好我也选的xilinx

出0入0汤圆

发表于 2012-1-13 23:52:58 | 显示全部楼层
用的是ALTERA的,对xilinx不咋熟悉,也在学习FPGA中。

出0入0汤圆

发表于 2012-1-13 23:58:24 | 显示全部楼层
我也在学  不过还没入门呢

出0入0汤圆

 楼主| 发表于 2012-1-14 07:53:43 | 显示全部楼层
回复【4楼】cc6868
用的是altera的,对xilinx不咋熟悉,也在学习fpga中。
-----------------------------------------------------------------------

反正逻辑是一样的,只是在不同的硬件上

出0入0汤圆

 楼主| 发表于 2012-1-14 11:10:24 | 显示全部楼层
1.         2输入逻辑门的verilog源代码
                                                           module gates2(
                                                           input wire a,
                                                           input wire b,
                                                           output wire[5:0]z
                                                           );
                                                           
                                                           assign z[5] = a&b;
                                                           assign z[4] = ~(a&b);
                                                           assign z[3] = a|b;
                                                           assign z[2] = ~(a|b);
                                                           assign z[1] = a^b;
                                                           assign z[0] = a~^b;
                                                           endmodule
        所有的Verilog程序都以module(模块)声明语句开始,其中包含模块名(此例中为gates2),紧随其后的是一个输入输出信号列表,包含信号名、方向和类型。输入输出信号的方向通过input,output及inout(双向信号)语句声明。信号类型可以是wire或reg。在2输入逻辑门的verilog源代码中所有的信号都是wire类型。图1-1所示电路中共有6个独立的输出信号,我们可以采用数组的形式来描述它们:
                                        output wire [5:0] z
我们用assign语句来定义图1-1中每个逻辑门的输出。assign赋值语句为并发语句,所以在程序中我们可以用任意的顺序来书写各输出赋值语句。

2. 2输入逻辑门的VHDL源代码
        library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity gates2 is
        PORT(a: IN STD_LOGIC;
             b: IN STD_LOGIC;
                  z: OUT STD_LOGIC_VECTOR(5 DOWNTO 0)
        );
end gates2;

architecture Behavioral of gates2 is

begin
        z(5)<=a AND b;
        z(4)<=NOT(a AND b);
        z(3)<=a OR b;
        z(2)<=NOT(a OR b);
        z(1)<=a XOR b;
        z(0)<=NOT(a XOR b);

end Behavioral;


仿真图 (原文件名:QQ截图20120114110904.png)

出0入0汤圆

 楼主| 发表于 2012-1-14 12:50:51 | 显示全部楼层
二位比较器的verilog源代码
module comp2bit (
input wire [1:0] a,
input wire [1:0] b,
output wire a_eq_b,
output wire a_gt_b,
output wire a_lt_b
);

assign a_eq_b = ~b[1] &  ~b[0] &  ~a[1] &  ~a[0]
                 | ~b[1] &  b[0] & ~a[1] &  a[0]
                 |  b[1] & ~b[0] &  a[1] & ~a[0]
                 |  b[1] &  b[0] &  a[1] &  a[0];

assign a_gt_b = ~b[1] & a[1]
                | ~b[1] & ~b[0] &  a[0]
                | ~b[0] &  a[1] &  a[0];

assign a_lt_b = b[1] & ~a[1]
               | b[1] &  b[0] & ~a[0]
               | b[0] & ~a[1] & ~a[0];
endmodule

二位比较器的VHDL源代码

Library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity comp2bit is
  PORT(a: IN STD_LOGIC_vector(1 DOWNTO 0);
                 b: IN STD_LOGIC_vector(1 DOWNTO 0);
            a_eq_b: OUT STD_LOGIC;
       a_gt_b: OUT STD_LOGIC;
       a_lt_b: OUT STD_LOGIC);
end comp2bit;

architecture Behavioral of comp2bit is

begin
        a_eq_b<= (NOT b(1) AND NOT b(0) AND NOT a(1) AND NOT a(0)) OR (NOT b(1) AND b(0) AND NOT a(1) AND a(0))OR (b(1) AND NOT b(0) AND a(1) AND NOT a(0))OR (b(1) AND b(0) AND a(1) AND a(0));
        a_gt_b<= (NOT b(1) AND a(1)) OR (NOT b(1) AND NOT b(0) AND a(0)) OR (b(1) AND NOT b(0) AND a(1) AND NOT a(0)) OR (NOT b(1) AND a(1) AND a(0));
        a_lt_b<= (b(1) AND NOT a(1)) OR (b(1) AND b(0) AND NOT a(0)) OR (b(1) AND NOT b(0) AND a(1) AND NOT a(0)) OR (b(0) AND NOT a(1) AND NOT a(0));
end Behavioral;

出0入0汤圆

 楼主| 发表于 2012-1-14 16:42:52 | 显示全部楼层
4位2选1多路选择器的verilog源代码
                                                      module mux24a(
input wire [3:0] a,
input wire [3:0] b,
input wire s,
output wire [3:0] y
);

assign y = {4{~s}} & a | {4{s}} & b;

endmodule
VHDL源码
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity mux24a is
        PORT(a: IN STD_LOGIC_VECTOR(3 DOWNTO 0);
                  b: IN STD_LOGIC_VECTOR(3 DOWNTO 0);
                  s: IN STD_LOGIC;
                  y: OUT STD_LOGIC_VECTOR(3 DOWNTO 0)
                );
end mux24a;

architecture Behavioral of mux24a is

begin
        y<=a WHEN s='0' ELSE
                b;

end Behavioral;

出0入0汤圆

 楼主| 发表于 2012-1-14 17:37:29 | 显示全部楼层
7段译码器的verilog源代码
                                                   module hex7seg (
                                                   input wire [3:0] x,
                                                   output reg [6:0] a_to_g,
                                                   output wire [3:0] an
                                                   );
                                                   assign an=4'b0000;
                                                   always @ ( * )
                                                   case (x)
                                                   0: a_to_g = 7'b0000001;
                                                   1: a_to_g = 7'b1001111;
                                                   2: a_to_g = 7'b0010010;
                                                   3: a_to_g = 7'b0000110;
                                                   4: a_to_g = 7'b1001100;
                                                   5: a_to_g = 7'b0100100;
                                                   6: a_to_g = 7'b0100000;
                                                   7: a_to_g = 7'b0001111;
                                                   8: a_to_g = 7'b0000000;
                                                   9: a_to_g = 7'b0000100;
                                                   'hA: a_to_g = 7'b0001000;
                                                   'hB: a_to_g = 7'b1100000;
                                                   'hC: a_to_g = 7'b0110001;
                                                   'hD: a_to_g = 7'b1000010;
    'hE: a_to_g = 7'b0110000;
    'hF: a_to_g = 7'b0111000;
   default: a_to_g = 7'b0000001;  // 0
endcase
endmodule
7段译码器的VHDL源代码
entity hex7seg is
        PORT(x: IN STD_LOGIC_VECTOR(3 DOWNTO 0);
                  a_to_g: OUT STD_LOGIC_VECTOR(6 DOWNTO 0);
                  an: OUT STD_LOGIC_VECTOR(3 DOWNTO 0)
           );
end hex7seg;

architecture Behavioral of hex7seg is
   
begin
        PROCESS (x)
        BEGIN
        an<="0000";
        CASE x IS
        WHEN "0000"=>        a_to_g <= "0000001";
   WHEN "0001"=> a_to_g <= "1001111";
   WHEN "0010"=>        a_to_g <= "0010010";
   WHEN "0011"=>        a_to_g <= "0000110";
   WHEN "0100"=>        a_to_g <= "1001100";
   WHEN "0101"=>        a_to_g <= "0100100";
   WHEN "0110"=>        a_to_g <= "0100000";
   WHEN "0111"=>        a_to_g <= "0001111";
   WHEN "1000"=>        a_to_g <= "0000000";
   WHEN "1001"=>        a_to_g <= "0000100";
   WHEN "1010"=>        a_to_g <= "0001000";
   WHEN "1011"=>        a_to_g <= "1100000";
   WHEN "1100"=>        a_to_g <= "0110001";
   WHEN "1101"=>        a_to_g <= "1000010";
   WHEN "1110"=>        a_to_g <= "0110000";
   WHEN "1111"=>        a_to_g <= "0111000";
   WHEN OTHERS => a_to_g <="0000001";  
        END CASE;
  END PROCESS;

end Behavioral;

出0入0汤圆

发表于 2012-1-14 17:47:20 | 显示全部楼层
南航,我觉得写FPGA,应当以时序 状态机 结合IP核为主,做别人做过的组合意思不大。不能培养思维

出0入0汤圆

发表于 2012-1-14 17:55:46 | 显示全部楼层
我也在学 刚买了板子 红心电子的 呵呵 一起学咯

出0入0汤圆

发表于 2012-1-14 19:12:40 | 显示全部楼层
只玩过51,跑过流水灯.能学会FPGA吗?用什么开发板学好一点,价格多少.

出0入0汤圆

 楼主| 发表于 2012-1-14 19:20:40 | 显示全部楼层
回复【11楼】NJ8888 NJ8888
南航,我觉得写fpga,应当以时序 状态机 结合ip核为主,做别人做过的组合意思不大。不能培养思维
-----------------------------------------------------------------------

多谢指导

出0入0汤圆

发表于 2012-1-14 22:32:49 | 显示全部楼层
正在学习...

出0入0汤圆

发表于 2012-1-16 11:40:47 | 显示全部楼层
我搞个群,真在学习FPGA,大伙一起讨论,群号129128823,群里解决不了或有趣的问题,大伙再上传论坛,大家有意思的话可以加入,暂无人,等待Ing.

出0入0汤圆

发表于 2012-1-16 12:24:32 | 显示全部楼层
组合电路
无论是X家还是A家的软件都有范例提供了
综合一下看看结果

还是要有具体的项目做才能提高的快

出0入0汤圆

发表于 2012-1-28 17:44:48 | 显示全部楼层
正在学习

出0入0汤圆

发表于 2012-2-3 09:55:13 | 显示全部楼层
正在学习中

出0入0汤圆

发表于 2012-2-3 09:55:45 | 显示全部楼层
回复【16楼】xiangzi28
-----------------------------------------------------------------------

加我吧!我加了群

出0入0汤圆

发表于 2012-2-5 23:42:34 | 显示全部楼层
我都无从下手

出0入4汤圆

发表于 2012-2-13 10:42:43 | 显示全部楼层
我以前学altera的,现在学lattice,感觉isplever没quartus好使,哎

出0入0汤圆

发表于 2012-2-13 11:51:43 | 显示全部楼层
想学……,还没动手的

出0入0汤圆

发表于 2012-2-13 11:51:53 | 显示全部楼层
想学……,还没动手的

出0入0汤圆

发表于 2012-2-14 20:37:04 | 显示全部楼层
学习中,关注中

出0入0汤圆

发表于 2012-2-15 01:27:17 | 显示全部楼层
学习中,关注中

出0入0汤圆

发表于 2012-2-15 19:21:02 | 显示全部楼层
感觉altera上手容易些,xilinx比较麻烦

出0入0汤圆

发表于 2012-2-15 22:16:48 | 显示全部楼层
算我一个哦
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-7-24 11:25

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

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