Új hozzászólás Aktív témák

  • ftc

    nagyúr

    válasz VaniliásRönk #3 üzenetére

    library ieee;
    use ieee.std_logic_1164.all;
    use ieee.std_logic_unsigned.all;
    use ieee.std_logic_arith.all;
    entity ALU is
    port( A: in std_logic_vector(3 downto 0);
    B: in std_logic_vector(3 downto 0);
    sel: in std_logic_vector(2 downto 0);
    result: out std_logic_vector(3 downto 0);
    carry: out std_logic);
    end ALU;
    architecture behv of ALU is
    begin
    process(A,B,Sel)
    variable tempresult:std_logic_vector (4 downto 0);
    begin
    case sel is
    when "000" => --000 add.
    tempresult := ('0' & A)+('0' & B);
    when "001" => --001 sub
    tempresult := ('0' & A) + (not ('0' & B)) + 1;
    when "010" => --010 mul.
    tempresult := ('0' & A)*('0' & B);
    when "011" => --011 div.
    tempresult := ('0' & A)/('0' & B);
    when "100" => --100 and
    tempresult := ('0' & A) and ('0' & B);
    when "101" => --101 or
    tempresult := ('0' & A) or ('0' & B);
    end case;
    result<=tempresult(3 downto 0);
    carry<=tempresult(4);
    end process;
    end behv;

    ez egy vhdl kód egy ALU-é... jelenleg ezt is programozni kell ezt szeretnék felépíteni egy magasabb szintű program nyelvel...ami az OpenCL lenne... amit látsz ez csak egy kis alap... a legnagyobb gond, hogy 90%-ban elveszel a részletekben egy nagy projektnél

Új hozzászólás Aktív témák