eGospodarka.pl
eGospodarka.pl poleca

eGospodarka.plGrupypl.misc.elektronikaJeszcze raz VHDL - problem ze zwięzłym zapisem › Jeszcze raz VHDL - problem ze zwięzłym zapisem
  • X-Received: by 10.140.21.111 with SMTP id 102mr212389qgk.4.1432427827343; Sat, 23 May
    2015 17:37:07 -0700 (PDT)
    X-Received: by 10.140.21.111 with SMTP id 102mr212389qgk.4.1432427827343; Sat, 23 May
    2015 17:37:07 -0700 (PDT)
    Path: news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!go
    blin3!goblin.stu.neva.ru!news.ripco.com!news.glorb.com!j8no8568214igd.0!news-ou
    t.google.com!4ni34qgh.1!nntp.google.com!z60no3468924qgd.1!postnews.google.com!g
    legroupsg2000goo.googlegroups.com!not-for-mail
    Newsgroups: pl.misc.elektronika
    Date: Sat, 23 May 2015 17:37:07 -0700 (PDT)
    Complaints-To: g...@g...com
    Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=185.53.155.164;
    posting-account=67yd9woAAAAHUu8VHyA7Js47M98NE3m3
    NNTP-Posting-Host: 185.53.155.164
    User-Agent: G2/1.0
    MIME-Version: 1.0
    Message-ID: <8...@g...com>
    Subject: Jeszcze raz VHDL - problem ze zwięzłym zapisem
    From: s...@g...com
    Injection-Date: Sun, 24 May 2015 00:37:07 +0000
    Content-Type: text/plain; charset=ISO-8859-2
    Content-Transfer-Encoding: quoted-printable
    Xref: news-archive.icm.edu.pl pl.misc.elektronika:681699
    [ ukryj nagłówki ]

    Problem jest w zasadzie rozwinięciem poprzedniego wątkaDo rzeczy, układ ma obliczać
    coś takiego: C=|R(0)+...+R(15)-R(16)-....-R(31)|, gdzie C,R(i)-liczby 11 bitowe bez
    znaku. R(i) są to kolejne sekcje rejestru posuwnego, w którym na pierwszą sekcję jest
    podawana 11 bitowa liczba "A" (bez znaku). Układ działa poprawnie zarówno na
    symulatorze jak i na żywym organiźmie. Wszystkie operacje +/- zrobiłem krok po kroku.
    A co gdybym miał pierdyljon sekcji rejestru posuwnego?
    Jak to zwięźlej zapisać? Kod wygląda tak:


    library IEEE;
    use IEEE.STD_LOGIC_1164.ALL;
    use IEEE.NUMERIC_STD.ALL;
    library UNISIM;
    use UNISIM.VComponents.all;

    entity amod is

    Port ( A : in STD_LOGIC_VECTOR (10 downto 0);
    CLK : in STD_LOGIC;
    C : out STD_LOGIC_VECTOR (10 downto 0));
    end amod;

    architecture Behavioral of amod is
    type Shift_Register_Type is array (31 downto 0) of std_logic_vector(10 downto 0);
    signal Cs:std_logic_vector(14 downto 0):="000000000000000";
    signal Rejestr:Shift_Register_Type;
    begin



    process(CLK)
    begin
    if rising_edge(CLK) then
    Rejestr<=Rejestr(30 downto 0)&A;
    Cs<=std_logic_vector(to_unsigned(abs(to_integer(sign
    ed('0'&Rejestr(0)))+
    to_integer(signed('0'&Rejestr(1)))+
    to_integer(signed('0'&Rejestr(2)))+
    to_integer(signed('0'&Rejestr(3)))+
    to_integer(signed('0'&Rejestr(4)))+
    to_integer(signed('0'&Rejestr(5)))+
    to_integer(signed('0'&Rejestr(6)))+
    to_integer(signed('0'&Rejestr(7)))+
    to_integer(signed('0'&Rejestr(8)))+
    to_integer(signed('0'&Rejestr(9)))+
    to_integer(signed('0'&Rejestr(10)))+
    to_integer(signed('0'&Rejestr(11)))+
    to_integer(signed('0'&Rejestr(12)))+
    to_integer(signed('0'&Rejestr(13)))+
    to_integer(signed('0'&Rejestr(14)))+
    to_integer(signed('0'&Rejestr(15)))-
    to_integer(signed('0'&Rejestr(16)))-
    to_integer(signed('0'&Rejestr(17)))-
    to_integer(signed('0'&Rejestr(18)))-
    to_integer(signed('0'&Rejestr(19)))-
    to_integer(signed('0'&Rejestr(20)))-
    to_integer(signed('0'&Rejestr(21)))-
    to_integer(signed('0'&Rejestr(22)))-
    to_integer(signed('0'&Rejestr(23)))-
    to_integer(signed('0'&Rejestr(24)))-
    to_integer(signed('0'&Rejestr(25)))-
    to_integer(signed('0'&Rejestr(26)))-
    to_integer(signed('0'&Rejestr(27)))-
    to_integer(signed('0'&Rejestr(28)))-
    to_integer(signed('0'&Rejestr(29)))-
    to_integer(signed('0'&Rejestr(30)))-
    to_integer(signed('0'&Rejestr(31)))),15));

    end if;
    end process;
    C<=Cs(14 downto 4);
    end Behavioral;

Podziel się

Poleć ten post znajomemu poleć

Wydrukuj ten post drukuj


Następne wpisy z tego wątku

Najnowsze wątki z tej grupy


Najnowsze wątki

Szukaj w grupach

Eksperci egospodarka.pl

1 1 1

Wpisz nazwę miasta, dla którego chcesz znaleźć jednostkę ZUS.

Wzory dokumentów

Bezpłatne wzory dokumentów i formularzy.
Wyszukaj i pobierz za darmo: