Thông báo

Collapse
No announcement yet.

Cần giúp đỡ về code vhdl

Collapse
X
 
  • Lọc
  • Giờ
  • Show
Clear All
new posts

  • Cần giúp đỡ về code vhdl

    em đang viết 1 chương trình đơn giản là bộ đếm 4 bit dùng vhdl nhưng gặp 1 lỗi hơi củ chuối,ai pro vào giúp đỡ với

    Code:
    library ieee;
    use ieee.std_logic_1164.all;
    package count is
    constant n:integer:=10;
    subtype int8 is integer range 0 to n;
    procedure up(clk: in std_logic;o:inout int8);
    end count;
    
    package body count is
    procedure up(clk:in std_logic;o:inout int8) is
    variable temp:int8;
    begin
    if clk'event and clk='1'then
    if(temp<n) then temp:=temp+1;
    else temp:=0;
    end if;
    o:=temp;
    end if;
    end up;
    end count;
    
    library ieee;
    use ieee.std_logic_1164.all;
    library design_lib;
    use design_lib.count.all;
    entity upcount2 is
    port(clock_50:in std_logic;
         ledr:out int8);
    end upcount2;
    
    architecture bhv of upcount2 is
    begin
    process(clock_50)
    variable o:int8;
    begin
    up(clock_50,o);
    ledr<=o;
    end process;
    end bhv;
    khi mà chạy thì chỉ ledr chỉ lên 1 giữ nguyên ko thấy biến đổi theo clock, em thử thay trực tiếp temp bằng biến o thì ra đúng, nhưng không ko hiểu là 2 cách này khác nhau ở chỗ nào,ai bít chỉ giùm
    Attached Files

Về tác giả

Collapse

Kinhcan_89 Tìm hiểu thêm về Kinhcan_89

Bài viết mới nhất

Collapse

Đang tải...
X