Thông báo

Collapse
No announcement yet.

giúp em cái code này với

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

  • tonyvandinh
    replied
    Nguyên văn bởi naigia88 Xem bài viết
    thanks bro có thể giải thích cho em tại sao bị lỗi ko ạ?
    LIBRARY IEEE;
    USE IEEE.std_logic_1164.all;
    USE IEEE.std_logic_unsigned.all;

    ENTITY adder8 is port(
    a: in std_logic_vector(7 DOWNTO 0);
    b: in std_logic_vector(7 DOWNTO 0);
    ci,clk,set,reset: in std_logic;
    co: out std_logic;
    s: out std_logic_vector(7 DOWNTO 0));
    end adder8;

    architecture equation of adder8 is
    begin
    process(clk,set,reset)
    variable mid: std_logic_vector(8 DOWNTO 0);
    begin
    if (reset = '1') then
    mid := (others => '0');
    elsif (set = '1') then
    mid := (others => '1');
    elsif ((clk = '1') and (clk'EVENT)) then
    mid := ('0'&a)+('0'&b)+ci;
    co <= mid(8);
    s <= mid(7 DOWNTO 0);
    end if;
    end process;
    end equation;

    ---
    Đã lâu rồi tôi kô viết VHDL, nhưng căn bản là ở architecture, bạn chỉ có thể dùng concurrent statement. "if" là sequential statement nên chỉ có thể dùng trong "process" với sensitivity list.

    tvd

    Leave a comment:


  • naigia88
    replied
    thanks bro có thể giải thích cho em tại sao bị lỗi ko ạ?

    Leave a comment:


  • thaielectric
    replied
    Haha...

    LIBRARY IEEE;
    USE IEEE.std_logic_1164.all;
    USE IEEE.std_logic_unsigned.all;

    ENTITY adder8 is port(
    a: in std_logic_vector(7 DOWNTO 0);
    b: in std_logic_vector(7 DOWNTO 0);
    ci,clk,set,reset: in std_logic;
    co: out std_logic;
    s: out std_logic_vector(7 DOWNTO 0));
    end adder8;

    architecture equation of adder8 is
    begin
    process(a,b,ci,clk,set,reset)
    variable mid: std_logic_vector(8 DOWNTO 0);
    begin
    if (clk = '1') and (clk'EVENT) and (reset= '0')and (set='1') then
    mid(3 downto 0) := ('0'&a)+('0'&b)+ci;
    end if;
    co <= mid(8);
    s <= mid(7 DOWNTO 0);
    end process;
    end equation;

    Leave a comment:


  • naigia88
    started a topic giúp em cái code này với

    giúp em cái code này với

    em mới học vhdl
    làm bộ cộng 8bit nhưng có lỗi tìm mãi mà ko thấy lỗi
    nhờ các bro thỉnh giáo ạ
    thakns trc
    LIBRARY IEEE;
    USE IEEE.std_logic_1164.all;
    USE IEEE.std_logic_unsigned.all;

    ENTITY adder8 is port(
    a: in std_logic_vector(7 DOWNTO 0);
    b: in std_logic_vector(7 DOWNTO 0);
    ci,clk,set,reset: in std_logic;
    co: out std_logic;
    s: out std_logic_vector(7 DOWNTO 0)
    );
    end entity adder8;
    architecture equation of adder8 is
    signal mid : std_logic_vector(8 DOWNTO 0);
    BEGIN
    if (clk='1')and (clk'EVENT) and (reset='0')and (set='1') then
    mid <= ('0'&a)+('0'&b)+ci;
    end if;
    co <= mid(8);
    s<= mid(7 DOWNTO 0);
    END equation;


    --lỗi ở dòng IF

Về tác giả

Collapse

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

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

Collapse

Đang tải...
X