如何例化元件,是在不会,希望大家帮忙下

[复制链接]
 楼主| wangjun403 发表于 2011-3-21 22:12 | 显示全部楼层 |阅读模式
我只会简单的例化,比如说顶层和底层的引脚都一样的那种
下面的图我就不会了

我自己的例化程序,编译不成功,希望大家可以帮忙下
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.std_logic_unsigned.all;

  4. entity clock is
  5. port(
  6. clk,reset :in std_logic;
  7. time_out :out std_logic
  8. );
  9. end entity;

  10. architecture rtl of clock is

  11. component time_ms is
  12. port(
  13. clk ,reset :in std_logic;
  14. ms_out :out std_logic
  15. );
  16. end component;

  17. component time_sec is
  18. port(
  19. clk ,reset :in std_logic;
  20. ms_in :in std_logic;
  21. sec_out :out std_logic
  22. );
  23. end component;

  24. component time_min is
  25. port(
  26. clk ,reset :in std_logic;
  27. sec_in :in std_logic;
  28. min_out :out std_logic
  29. );
  30. end component;

  31. component time_hour is
  32. port(
  33. clk ,reset :in std_logic;
  34. min_in :in std_logic;
  35. hour_out :out std_logic
  36. );
  37. end component;

  38. begin
  39. u1:time_ms port map(clk=>clk,reset=>reset);
  40. u2:time_sec port map(clk=>clk,reset=>reset,ms_in=>ms_out);
  41. u3:time_min port map(clk=>clk,reset=>reset,sec_in=>sec_out);
  42. u4:time_hour port map(clk=>clk,reset=>reset,hour_in=>min_hour,hour_out=>time_out);
  43. end architecture;
 楼主| wangjun403 发表于 2011-3-21 23:26 | 显示全部楼层
自己顶下
SuperX-man 发表于 2011-3-22 14:06 | 显示全部楼层
你说的编译不成功.那报错信息是什么,能贴出来看下不?
因为你还包含了4个元件.其中任何一个有错误,都会导致编译不成功.
可能不光是你顶层的问题.
另外,你clk和rst共接那么多的子元件.建议你加个BUFG,别直接相连
 楼主| wangjun403 发表于 2011-3-22 14:44 | 显示全部楼层
单个编译都是成功的
不然也不可以生成原理图上需要的符号
 楼主| wangjun403 发表于 2011-3-22 20:10 | 显示全部楼层
帮帮我啊,我实在不会了
SuperX-man 发表于 2011-3-23 11:38 | 显示全部楼层
楼主用的应该是QUARTUS吧....你编译错误的话,能否把报错信息贴出来哈.

今天仔细看了你的代码...发现是你没写对哈.

你component中定义的引脚..和你port map中的 有些对应不起来阿.
在component中定义了的.必须在port map中一一对应,不接的也必须声明是open还是gnd;
SuperX-man 发表于 2011-3-23 11:39 | 显示全部楼层
举个例子来说,你time_hour中 只有 rst,clk,min_in,hour_out.....但是在你下面map的时候.怎么就多了一个hour_in阿
您需要登录后才可以回帖 登录 | 注册

本版积分规则

0

主题

629

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部

0

主题

629

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部