8/24/13

www.gstitt.ece.ufl.edu/vhdl/mux_2x1_tb.vhd

-G r e gS t i t t -U n i v e r s i t yo fF l o r i d a l i b r a r yi e e e ; u s ei e e e . s t d _ l o g i c _ 1 1 6 4 . a l l ; u s ei e e e . n u m e r i c _ s t d . a l l ; e n t i t ym u x _ 2 x 1 _ t bi s e n dm u x _ 2 x 1 _ t b ;

a r c h i t e c t u r eT Bo fm u x _ 2 x 1 _ t bi s c o m p o n e n tm u x _ 2 x 1 p o r t ( i n 1 :i n s t d _ l o g i c ; i n 2 :i n s t d _ l o g i c ; s e l :i n s t d _ l o g i c ; o u t p u t:o u ts t d _ l o g i c ) ; e n dc o m p o n e n t ; s i g n a li n 1 :s t d _ l o g i c ; s i g n a li n 2 :s t d _ l o g i c ; s i g n a ls e l :s t d _ l o g i c ; s i g n a lo u t p u t _ w i t h _ s e l e c t:s t d _ l o g i c ; s i g n a lo u t p u t _ w h e n _ e l s e :s t d _ l o g i c ; s i g n a lo u t p u t _ i f :s t d _ l o g i c ; s i g n a lo u t p u t _ c a s e :s t d _ l o g i c ; b e g i n -T B U _ W I T H _ S E L E C T:e n t i t yw o r k . m u x _ 2 x 1 ( W I T H _ S E L E C T ) p o r tm a p( i n 1 = >i n 1 , i n 2 = >i n 2 , s e l = >s e l , o u t p u t= >o u t p u t _ w i t h _ s e l e c t ) ; U _ W H E N _ E L S E:e n t i t yw o r k . m u x _ 2 x 1 ( W H E N _ E L S E ) p o r tm a p( i n 1 = >i n 1 , i n 2 = >i n 2 , s e l = >s e l , o u t p u t= >o u t p u t _ w h e n _ e l s e ) ; U _ I F:e n t i t yw o r k . m u x _ 2 x 1 ( I F _ S T A T E M E N T ) p o r tm a p( i n 1 = >i n 1 , i n 2 = >i n 2 , s e l = >s e l , o u t p u t= >o u t p u t _ i f ) ; U _ C A S E:e n t i t yw o r k . m u x _ 2 x 1 ( C A S E _ S T A T E M E N T ) p o r tm a p( i n 1 = >i n 1 , i n 2 = >i n 2 , s e l = >s e l , o u t p u t= >o u t p u t _ c a s e ) ; p r o c e s s
www.gstitt.ece.ufl.edu/vhdl/mux_2x1_tb.vhd 1/2

a s s e r t ( o u t p u t _ w h e n _ e l s e=m u x _ t e s t ( i n 1 .s e l ) ) r e p o r t" E r r o r:o u t p u t _ i fi n c o r r e c tf o ri n 1="&s t d _ l o g i c ' i m a g e ( i n 1 )&" i n 2="&s t d _ l o g i c ' i m a g e ( i n 2 )&"s e l="&s t d _ l o g i c ' i m a g e ( s e l )s e v e r i t y w a r n i n g . e n dm u x _ t e s t .i n 2 . b e g i n -t e s ta l li n p u tc o m b i n a t i o n s f o rii n0t o7l o o p t e m p: =s t d _ l o g i c _ v e c t o r ( t o _ u n s i g n e d ( i .i n 2 .vhd 2/2 . e n dT B . -i w a i t . i n 2< =t e m p ( 1 ) .edu/vhdl/mux_2x1_tb. a s s e r t ( o u t p u t _ i f=m u x _ t e s t ( i n 1 .8/24/13 www. e n dl o o p .i n 2 . e n dp r o c e s s .ufl. s i g n a ls e l:s t d _ l o g i c ) r e t u r ns t d _ l o g i ci s b e g i n -m u x _ t e s t i f( s e l=' 0 ' )t h e n r e t u r ni n 1 . www.edu/vhdl/mux_2x1_tb.i n 2 .3 ) ) .gstitt.s e l ) ) r e p o r t" E r r o r:o u t p u t _ w i t h _ s e l e c ti n c o r r e c tf o ri n 1="& s t d _ l o g i c ' i m a g e ( i n 1 )&"i n 2="&s t d _ l o g i c ' i m a g e ( i n 2 )&"s e l="& s t d _ l o g i c ' i m a g e ( s e l )s e v e r i t yw a r n i n g .ece. s e l< =t e m p ( 0 ) . e l s e r e t u r ni n 2 . e n di f .s e l ) ) r e p o r t" E r r o r:o u t p u t _ w h e n _ e l s ei n c o r r e c tf o ri n 1="& s t d _ l o g i c ' i m a g e ( i n 1 )&"i n 2="&s t d _ l o g i c ' i m a g e ( i n 2 )&"s e l="& s t d _ l o g i c ' i m a g e ( s e l )s e v e r i t yw a r n i n g . s i g n a li n 2:s t d _ l o g i c . i n 1< =t e m p ( 2 ) .s e l ) ) r e p o r t" E r r o r:o u t p u t _ c a s ei n c o r r e c tf o ri n 1="&s t d _ l o g i c ' i m a g e ( i n 1 )& "i n 2="&s t d _ l o g i c ' i m a g e ( i n 2 )&"s e l="&s t d _ l o g i c ' i m a g e ( s e l )s e v e r i t y w a r n i n g . w a i tf o r1 0n s . a s s e r t ( o u t p u t _ w i t h _ s e l e c t=m u x _ t e s t ( i n 1 . f u n c t i o nm u x _ t e s t( s i g n a li n 1:s t d _ l o g i c . a s s e r t ( o u t p u t _ c a s e=m u x _ t e s t ( i n 1 .ufl.ece.vhd v a r i a b l et e m p:s t d _ l o g i c _ v e c t o r ( 2d o w n t o0 ) .gstitt.

Sign up to vote on this title
UsefulNot useful