:
..
2008 .
(?!) (). .
EPF10K20RC240-4 FLEX10K Altera MAX+plus II 10.2 BASELINE MATLAB 6.5.
FLEX10K - . , , (EAB, Embedded Array Block), , . , .
,
(?!) .
-:
-:
1) 1
2) 2
3) 2
=3 :
, , 2, (?!). , :
.4 Mult_a
.5 Mult_b .6 Mult_c
Altera FLEX10K20RC240-4. :
|
20000 |
|
1152 |
|
144 |
() |
12288 |
|
189 |
|
6 |
|
144 |
|
24 |
|
24 |
1
. MAX+plus . . . ai 2m bi 2n. n m , ( ). m=n=6.
MATLAB :
-
- (fix);
- (round);
- (floor);
- (ceil);
, , . .
( : 0,6
: 29 )
( !!)
.10
.11
.12
.13
, .
:
|
(DEC)
|
(DEC)
|
(BIN)
|
b1 |
0.126464868216455 |
8 |
1000 |
b2 |
-0.211575649599258 |
-14 |
10010 |
b3 |
0.211575649599257 |
14 |
1110 |
b4 |
-0.126464868216455 |
-8 |
11000 |
a1 |
1.000000000000000 |
-64 |
1000000 |
a2 |
0.927241545063816 |
-59 |
1000101 |
a3 |
0.888040485768699 |
-57 |
1000111 |
a4 |
0.284717905073458 |
-18 |
1101110 |
2(??)
( ??)
:
|
g(t) |
h(t) |
0 |
0,125 |
0.125 |
1 |
-0,334 |
-0,209 |
2 |
0,415 |
0,206 |
3 |
-0,244 |
-0,0401 |
4 |
-0,0488 |
-0,0882 |
5 |
0,148 |
0.0588 |
6 |
-0,0236 |
0,0354 |
7 |
-0,0957 |
-0,0595 |
8 |
0,0678 |
0,00865 |
9 |
0,0302 |
0,0354 |
10 |
-0,0607 |
-0,0235 |
3
- .
. 8- . .
, 8- . , . , ( , . 16-).
( ) . . .
:
1. btn .
2. reg_in reg_out
3. preobr_cod , ;
4. filter_gor
5. tffe-
6. l7segment h7segment (?!), .
.14
.
AHDL
FLEX10K :
( , ByteBlaster, BiteBlaster, JTAG, );
();
();
JTAG . JTAG MSEL0, MSEL1 .
JTAG (Joint Test Action Group) - (BST Boundary Scan Test). BST- . BST- . JTAG- : TDI, TDO, TMS, TCK, TRST. JTAG- . JTAG- . JTAG- MasterBlaster ByteBlasterMV.
1)TDI .( , . TCK.)
2)TDO .( , . TCK. - )
3)TMS ( BST)( () TAP. TCK. TMS TCK.)
4)TCK BST( BST. , TCK.)
5) TRST ()( ."0" BST- . TRST IEEE STD. 1149.1.)[2]
( ??)
AHDL :
1) (?):
, , , , .
2) (?):
( ? ! , ) , . , . .
3) -(?):
8- , , 16- . ( 16- ?? ?)
, 3 . .
4) (?)
5) (?!) (?) .
( .)
, () (, , ), . :
. AHDL ;
. AHDL ;
AHDL .
(, , )
,
( ??), :
- -115.8
- -8.63
:
: 2,8
, :
8.63-2.8=5.83 .
, MAX+PLUS II, MATLAB . .
|
Matlab 6.5 |
MAX+plus II
(DEC)
|
MAX+plus II
(HEX)
|
MAX+plus II
()
|
|
1 |
0,125 |
800 |
0320 |
0.125 |
20 |
2 |
-0,334 |
63398 |
F7A6 |
-0.334 |
A6 |
3 |
0,415 |
2658 |
0A62 |
0.4153 |
62 |
4 |
-0,244 |
63964 |
F9DC |
-0.246 |
DC |
5 |
-0,0488 |
65219 |
FEC3 |
-0.0491 |
C3 |
6 |
0,148 |
994 |
03B0 |
0.1553 |
B0 |
7 |
-0,0236 |
65390 |
FF6E |
-0.024 |
6E |
8 |
-0,0957 |
64919 |
FD97 |
-0.0965 |
97 |
9 |
0,0678 |
433 |
01B1 |
0.0676 |
B1 |
10 |
0,0302 |
191 |
00BF |
0.0298 |
BF |
11 |
-0,0607 |
65147 |
FE7B |
-0.0615 |
7B |
12 |
0,00998 |
66 |
0042 |
0.01 |
42 |
13 |
0,0362 |
231 |
00E7 |
0.0361 |
E7 |
14 |
-0,0242 |
65373 |
FF5D |
-0.0254 |
5D |
15 |
-0,0108 |
65461 |
FFB5 |
-0.011 |
B5 |
4
|
Matlab 6.5 |
MAX+plus II
(DEC)
|
MAX+plus II
(HEX)
|
MAX+plus II
()
|
|
1 |
0,125 |
800 |
0320 |
0.125 |
20 |
2 |
-0,209 |
64198 |
FAC6 |
-0.20906 |
C6 |
3 |
0,206 |
1320 |
0528 |
0.20625 |
28 |
4 |
-0,0401 |
65285 |
FF05 |
-0.0397 |
05 |
5 |
-0,0882 |
64968 |
FDC8 |
-00875 |
C8 |
6 |
0,0588 |
375 |
0177 |
0.05859 |
77 |
7 |
0,0354 |
230 |
00E6 |
0.0359 |
E6 |
8 |
-0,0595 |
65149 |
FE7D |
-0.0592 |
7D |
9 |
0,00865 |
46 |
002E |
0.0718 |
2E |
10 |
0,0354 |
237 |
00ED |
0.037 |
ED |
11 |
-0,0235 |
65385 |
FF69 |
-0.02375 |
69 |
12 |
-0,0133 |
65451 |
FFAB |
-0.0135 |
AB |
13 |
0,0226 |
146 |
0092 |
0.0228 |
92 |
14 |
-0,00278 |
65519 |
FFEF |
-0.00285 |
EF |
15 |
-0,0141 |
65445 |
FFA5 |
-0.01425 |
A5 |
5
(??), ) 6400( 26 =64 100).
( ?)
, . 60% 694 . . . (??)
( ?)
.. : . -(??) 2000 .
Altera . .. . - (??) 2003 .
.. ALTERA: , . ., -XXI, 2007 (2002).
.. Altera AHDL. : . ., , 2001 .
%
:
" "
: " "
: 5110
..
: ..
%
include "filter.inc";
include "button.inc";
include "ppreg.inc";
include "pk_dk.inc";
include "7segment.inc";
constant razx = 8;-- ?
constant razy = 16;-- ?
constant razb = 4;
constant raza = 8;
subdesign final
(
data[razx-1..0],clk,knopka : input;
reset : input = gnd;
out[razy-1..0] : output;
synhr,h : output;
la,lb,lc,ld,le,lf,lg : output;
ha,hb,hc,hd,he,hf,hg : output;
)
variable
preobr_cod : pk_dk with (width = razx);
h7seg,l7seg : 7segment;
reg_in : ppreg with (width = razx);
reg_out : ppreg with (width = razy);
btn : button with ( delay = 1, clock = 3175); --8000 25175
filtr_gor : filter with
(
wx = 8, -- xn
wy = 16, -- yn ??
wc1 = 5, -- b
wc2 = 7, -- a
rs = 6, -- b
ws = 23, -- sum
wp = 23, -- result
b1 = 8, -- b1
b2 = B"10010", -- b2
b3 = 14, -- b3
b4 = B"11000", -- b4
a2 = B"1000101", -- a2
a3 = B"1000111", -- a3
a4 = B"1101110", -- a4
wm = 6 ?
);-- !!
ce : node;
begin
reg_in.(clk,reset)=(clk,!reset);
reg_out.(clk,reset)=(clk,!reset);
btn.clk = clk;
filtr_gor.(clk,reset)=(clk,!reset);
preobr_cod.in[] = data[];
reg_in.data[] = preobr_cod.out[];
filtr_gor.vxod[]=reg_in.out[];
reg_out.data[]=filtr_gor.vixod[];
out[]=reg_out.out[];
l7seg.i[]=out[3..0];
h7seg.i[]=out[7..4];
(la,lb,lc,ld,le,lf,lg) = l7seg.(a,b,c,d,e,f,g);
(ha,hb,hc,hd,he,hf,hg) = h7seg.(a,b,c,d,e,f,g);
btn.btn = knopka;
ce = btn.out;
filtr_gor.ce = ce;
reg_in.ce = ce;
reg_out.ce = ce;
synhr = ce;
h = tffe(VCC,clk, , ,ce);
end;
%
.. 5110
..
%
include "mult_a1.inc";
include "mult_b.inc";
include "mult_c.inc";
PARAMETERS
(
wx = 8, -- xn
wy = 16, -- yn
wc1 = 5, -- b
wc2 = 7, -- a
rs = 6, -- b
ws = 23, -- sum
wp = 23, -- result
b1 = 8, -- b1
b2 = B"10010", -- b2
b3 = 14, -- b3
b4 = B"11000", -- b4
a2 = B"1000101", -- a2
a3 = B"1000111", -- a3
a4 = B"1101110", -- a4
wm = 6 --
);
subdesign filter
(
vxod[wx-1..0], clk : input;
ce : input=vcc;
reset : input=gnd;
vixod[wy-1..0] : output;
)
variable
sec_up : mult_a1 with (widthx = wx, widthc = wc1+rs, widths = ws, widthp = wp, bn= b1*(2^rs));
sec_mid1 : mult_b with (widthx = wx, widthy = wy, widthc1 = wc1+rs, widthc2=wc2, widthp = wp, an = a2, bn = b2*(2^rs));
sec_mid2 : mult_b with (widthx = wx, widthy = wy, widthc1 = wc1+rs, widthc2=wc2, widthp = wp, an = a3, bn = b3*(2^rs));
sec_down : mult_c with (widthx = wx, widthy = wy, widthc1 = wc1+rs, widthc2=wc2, widthp = wp, an = a4, bn = b4*(2^rs));
V[wy-1..0] : node;
begin
sec_mid1.(clock,clken,aclr) = (clk,ce,reset);
sec_mid2.(clock,clken,aclr) = (clk,ce,reset);
sec_down.(clock,clken,aclr) = (clk,ce,reset);
sec_up.xn[]=vxod[];
sec_mid1.xn[]=vxod[];
sec_mid2.xn[]=vxod[];
sec_down.xn[]=vxod[];
V[] = sec_up.result[wm+wy-1..wm];
sec_mid1.yn[]=V[];
sec_mid2.yn[]=V[];
sec_down.yn[]=V[];
sec_up.sum[]=sec_mid1.result[];
sec_mid1.sum[]=sec_mid2.result[];
sec_mid2.sum[]=sec_down.result[];
vixod[]=V[];
end;
%
.. 5110
..
%
parameters
(
width=8
);
subdesign pk_dk
(
in[width-1..0] : input;
out[width-1..0] : output;
)
variable
sign : node;
begin
sign = in[width-1] ;
if sign then out[] = (sign,!in[width-2..0])+1;
else out[] = in[];
end if;
end;
%
.. 5110
..
%
PARAMETERS
(
width=8
);
SUBDESIGN ppreg
(
data[width-1..0],clk : input;
ce : input = vcc;
reset : input = gnd;
out[width-1..0] : output;
)
variable
out[width-1..0] : dffe;
begin
out[].(clk,clrn,ena)=(clk,!reset,ce);
out[] = data[];
end;
%
.. 5110
..
%
PARAMETERS
(
delay = 1 --
, clock = 5175 --
);
CONSTANT modul = (delay*clock) DIV 1000;--
ASSERT (modul>2)
REPORT " delay*clock 2000"
SEVERITY ERROR;
CONSTANT width = LOG2(modul);
CONSTANT end_state = modul-1;
SUBDESIGN button
(
btn : INPUT;
clk : INPUT;
out : OUTPUT;
)
VARIABLE
div_out : NODE;
astart : NODE;
tr[width-1..0] : dffe;
BEGIN
tr[].(clk, ena) = (clk, astart);
astart = dff(VCC, !btn, div_out, );
IF tr[].q < end_state THEN
tr[].d = tr[].q + 1;
ELSE
tr[].d = 0;
END IF;
div_out = !dff((tr[].q == end_state),clk,,); --
out = dff(dff(VCC, astart,!out,), clk, ,); --
END;
%
%
% -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;
%
mult_a1
%
INCLUDE "lpm_mult.inc";
PARAMETERS
( widthx = 8, -- xn[]
widthc = 10, --
widths = 18, -- sum[]
widthp = 18, -- result[]
bn = 100 -- bn
);
SUBDESIGN mult_a1
( xn[widthx-1..0] : INPUT;
sum[widths-1..0] : INPUT;
result[widthp-1..0] : OUTPUT;
)
VARIABLE
mult_x : lpm_mult WITH (
LPM_WIDTHA = widthx,
LPM_WIDTHB = widthc,
LPM_WIDTHP = widthp,
LPM_WIDTHS = widths,
INPUT_B_IS_CONSTANT = "YES",
LPM_REPRESENTATION = "SIGNED",
USE_EAB = "OFF",
--LPM_PIPELINE = 1,
MAXIMIZE_SPEED = 6 );
BEGIN
mult_x.dataa[] = xn[];
mult_x.datab[] = bn;
mult_x.sum[] = sum[];
result[] = mult_x.result[];
END;
%
mult_b
%
INCLUDE "lpm_mult.inc";
PARAMETERS
(
widthx = 8, -- xn[]
widthy = 8, -- yn[]
widthc1 = 10, -- b
widthc2 = 10, --
widthp = 18, -- result[]
an = 100, -- -an ( - hex)
bn = 100 -- bn
);
CONSTANT widths= widthp;
SUBDESIGN mult_b
(
xn[widthx-1..0] : INPUT;
yn[widthy-1..0] : INPUT;
sum[widths-1..0] : INPUT;
clock : INPUT;
clken : INPUT = VCC;
aclr : INPUT = GND;
result[widthp-1..0] : OUTPUT;
)
VARIABLE
mult_x : lpm_mult WITH (
LPM_WIDTHA = widthx,
LPM_WIDTHB = widthc1,
LPM_WIDTHP = widthp,
LPM_WIDTHS = widths,
INPUT_B_IS_CONSTANT = "YES",
LPM_REPRESENTATION = "SIGNED",
USE_EAB = "OFF",
LPM_PIPELINE = 1,
MAXIMIZE_SPEED = 6
);
mult_y : lpm_mult WITH (
LPM_WIDTHA = widthy,
LPM_WIDTHB = widthc2,
LPM_WIDTHP = widthp,
LPM_WIDTHS = widths,
INPUT_B_IS_CONSTANT = "YES",
LPM_REPRESENTATION = "SIGNED",
USE_EAB = "OFF",
--LPM_PIPELINE = 1,
MAXIMIZE_SPEED = 6
);
BEGIN
mult_x.(clock, clken, aclr) = (clock, clken, aclr);
mult_x.dataa[] = xn[];
mult_x.datab[] = bn;
mult_x.sum[] = mult_y.result[];
result[] = mult_x.result[];
mult_y.dataa[] = yn[];
mult_y.datab[] = an;
mult_y.sum[] = sum[];
END;
%
mult_c
%
INCLUDE "lpm_mult.inc";
PARAMETERS
(
widthx = 8, -- xn[]
widthy = 8, -- yn[]
widthc1 = 10, -- b
widthc2 = 10, -- a
widthp = 18, -- result[]
an = 100, -- an
bn = 100 -- bn
);
CONSTANT widths= widthp;
SUBDESIGN mult_c
(
xn[widthx-1..0] : INPUT;
yn[widthy-1..0] : INPUT;
--sum[widths-1..0] : INPUT;
result[widthp-1..0] : OUTPUT;
clock : INPUT;
clken : INPUT = VCC;
aclr : INPUT = GND;
)
VARIABLE
mult_x : lpm_mult WITH (
LPM_WIDTHA = widthx,
LPM_WIDTHB = widthc1,
LPM_WIDTHP = widthp,
LPM_WIDTHS = widths,
INPUT_B_IS_CONSTANT = "YES",
LPM_REPRESENTATION = "SIGNED",
USE_EAB = "OFF",
LPM_PIPELINE = 1,
MAXIMIZE_SPEED = 6
);
mult_y : lpm_mult WITH (
LPM_WIDTHA = widthy,
LPM_WIDTHB = widthc2,
LPM_WIDTHP = widthp,
LPM_WIDTHS = widths,
INPUT_B_IS_CONSTANT = "YES",
LPM_REPRESENTATION = "SIGNED",
USE_EAB = "OFF",
--LPM_PIPELINE = 1,
MAXIMIZE_SPEED = 6
);
BEGIN
mult_x.(clock, clken, aclr) = (clock, clken, aclr);
mult_x.dataa[] = xn[];
mult_x.datab[] = bn;
mult_x.sum[] = mult_y.result[];
result[] = mult_x.result[];
mult_y.dataa[] = yn[];
mult_y.datab[] = an;
END;
|