Фильтр низкой частоты на ПЛИС EPF10K20RC240-4 семейства FLEX10K фирмы Altera, страница 6

%   -a-                                                                                                           %

% f|   |b                                                                                                          %

%   -g-                                                                                                           %

% e|   |c                                                                                                         %

%   -d-                                                                                                           %

%                                                                                                                                          %

% 0 1 2 3 4 5 6 7 8 9 A b C d E F      %

%                                                                                                                                          %

SUBDESIGN 7segment

(

                                            i[3..0]                                                     : INPUT;

                                            a, b, c, d, e, f, g  : OUTPUT;

)

BEGIN

                                                TABLE

                                               i[3..0]  =>       a, b, c, d, e, f, g;

                                               H"0"                =>       1, 1, 1, 1, 1, 1, 0;

                                               H"1"                =>       0, 1, 1, 0, 0, 0, 0;

                                               H"2"                =>       1, 1, 0, 1, 1, 0, 1;

                                               H"3"                =>       1, 1, 1, 1, 0, 0, 1;

                                               H"4"                =>       0, 1, 1, 0, 0, 1, 1;

                                               H"5"                =>       1, 0, 1, 1, 0, 1, 1;

                                               H"6"                =>       1, 0, 1, 1, 1, 1, 1;

                                               H"7"                =>       1, 1, 1, 0, 0, 0, 0;

                                               H"8"                =>       1, 1, 1, 1, 1, 1, 1;

                                               H"9"                =>       1, 1, 1, 1, 0, 1, 1;

                                               H"A"               =>       1, 1, 1, 0, 1, 1, 1;

                                               H"B"               =>       0, 0, 1, 1, 1, 1, 1;

                                               H"C"               =>       1, 0, 0, 1, 1, 1, 0;

                                               H"D"               =>       0, 1, 1, 1, 1, 0, 1;

                                               H"E"               =>       1, 0, 0, 1, 1, 1, 1;

                                               H"F"               =>       1, 0, 0, 0, 1, 1, 1;

                                                END TABLE;

        END;

Итоговая программа.

--- Выполнил студент гр. 310 Алёшин Р.И.

--- Иерархический проект

%

    FUNCTION 7segment(i[3..0])

                                            RETURNS(a,b,c,d,e,f,g);

    FUNCTION umnoj(dataa[8..0],  reset,  clk, setn, clock_en)

                                            WITH(koef)

                                            RETURNS(result[16..0]);

    FUNCTION preobr(vxod[7..0], reset, clk, setn, clock_en)

                                            RETURNS(vyxod[7..0]);

    FUNCTION reg_sdvig(data[width-1..0],  reset, clk, setn, clock_en)

                                            WITH(width, number)

                                            RETURNS(q[number-1..0][width-1..0]);

    FUNCTION summ_dop(dataa[7..0], datab[7..0],  reset, clk, setn, clock_en)

                                            RETURNS(result[8..0];

   FUNCTION summ_osnov(dataa[16..0], datab[16..0], datac[16..0], datad[16..0],

   datae[16..0], clk, reset, setn, clock_en)

   RETURNS(result[18..0]);

   FUNCTION drebezg(PB2, PB1, clk)

   RETURNS(ce);

%

   INCLUDE "reg_sdvig.inc";

   INCLUDE "7segment.inc";

   INCLUDE "preobr.inc";

   INCLUDE "umnoj.inc";

   INCLUDE "registr.inc";

   INCLUDE "summ_dop.inc";

   INCLUDE "summ_osnov.inc";

   INCLUDE "drebezg.inc";

   SUBDESIGN kursach

  ( PB2                                                                                               : INPUT ;

                                            PB1                                                                               : INPUT ;

    q[7..0]                                                                    : INPUT;

                                            clk                                                                     : INPUT;

    clk_e                                                                                  : OUTPUT;

                                            a_x, b_x, c_x, d_x, e_x, f_x, g_x          : OUTPUT;

                                            a_y, b_y, c_y, d_y, e_y, f_y, g_y          : OUTPUT;

                                            vixod[7..0]                                             : OUTPUT;

                                            data_v[18..0]                                         : OUTPUT;

data_1_mult[16..0]            :output;

data_2_mult[16..0]            :output;

data_3_mult[16..0]            :output;

data_4_mult[16..0]            :output;

data_3_summ[8..0]             :output;

vixoddek[7..0]             :output;  )

VARIABLE

--- Зададим перемножители

_mult_par1                         : umnoj WITH (koefficient = H"38");

_mult_par2                         : umnoj  WITH (koefficient= H"81");