Appendix C. Segments of Code
81
s i g n a l A _ i n : s t d _ l o g i c _ v e c t o r (63 d o w n t o 0);
s i g n a l B _ i n : s t d _ l o g i c _ v e c t o r (63 d o w n t o 0);
s i g n a l O P _ i n : s t d _ l o g i c ;
s i g n a l r e s e t _ i n : s t d _ l o g i c ;
s i g n a l R _ o u t : s t d _ l o g i c _ v e c t o r (63 d o w n t o 0);
s i g n a l O _ U _ o u t : s t d _ l o g i c _ v e c t o r (1 d o w n t o 0);
s i g n a l d o n e _ o u t : s t d _ l o g i c ;
s i g n a l c l k _ g _ i n : s t d _ l o g i c ;
b e g i n
c l k _ g <= not c l k _ g a f t e r 500 ns ;
A D D E R _ t o p _ m o d u l e : A D D E R _ F p o r t map ( A_in , B_in , OP_in , R_out , O_U_out ,
c l k _ g _ i n , ’1 ’ , r e s e t _ i n , d o n e _ o u t );
p r o c e s s
v a r i a b l e r e s e t _ d o n e : bit := ’0 ’;
f i l e
i n f i l e
: t e x t o p e n r e a d _ m o d e is p a t h &" P A T H \ t e s t b e n c h . txt ";
v a r i a b l e
i n l i n e
: l i n e ;
f i l e
o u t f i l e
: t e x t o p e n w r i t e _ m o d e is p a t h &" P A T H \ t e s t b e n c h _ r e s u l t s _ V H D L . txt ";
v a r i a b l e
o u t l i n e
: l i n e ;
v a r i a b l e
t m p 1 : b i t _ v e c t o r (63 d o w n t o 0);
v a r i a b l e
t m p 2 : s t r i n g (2 d o w n t o 2);
v a r i a b l e t m p 3 : s t r i n g (2 d o w n t o 2);
b e g i n
w a i t u n t i l c l k _ g = ’1 ’ and clk_g ’ e v e n t ;
if ( not e n d f i l e ( i n f i l e )) t h e n
r e a d l i n e ( infile , i n l i n e );
end if ;
for i in inline ’ r a n g e l o o p
if ( i < 65) t h e n
if ( i n l i n e ( i ) = ’1 ’) t h e n
A _ i n (64 - i ) <= ’1 ’;
e l s e
A _ i n (64 - i ) <= ’0 ’;
end if ;
end if ;
if ( i = 66) t h e n
if ( i n l i n e ( i ) = ’1 ’) t h e n
O P _ i n <= ’1 ’;
e l s e
O P _ i n <= ’0 ’;
end if ;
end if ;