13.07.2015 Views

ModuleWare Reference Guide - Hornad

ModuleWare Reference Guide - Hornad

ModuleWare Reference Guide - Hornad

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Arithmetic PartsAdder Subtractor (addsub)Adder Subtractor (addsub)This part adds or subtracts the values of the input bus din0, input busdin1 and scalar input port cin and places the result in the output busdout. The carry out from this result is placed in scalar output port cout.The addition or subtraction is decided by the value of the scalar inputport add_sub. The polarity of this port is controlled by the enumeratedparameter add_sub_type.The parameter sign_type selects the mode of the arithmetic operation:unsigned and signed.Parameters cin_type and cout_type control the polarity of ports cin andcout.This part is equivalent to an n-bit Adder Subtractor; where n is the maximum width of the portsdin and dout. The implementation of the Adder Subtractor is controlled via the synthesis script.The default action is addition. You are advised to use the Adder (add) if only the additionoperation is required. Synthesis of Adder Subtractor (addsub) infers both an adder andsubtractor.If input port cin is unconnected, it is driven by 0.Functiondout= din0 + din1 + cin= din0 - din1 - cin= din0 + din1 + cin= din0 - din1 - cinif add_sub = 1 and add_sub_type = ActiveHighif add_sub = 0 and add_sub_type = ActiveHighif add_sub = 0 and add_sub_type = ActiveLowif add_sub = 1 and add_sub_type = ActiveLowThe addition or subtraction is unsigned or signed depending of the value of the parametersign_type.If parameter cout_type = ActiveHigh:cout = 1= 0if there is a carry out in the arithmetic operationotherwiseTruth TableA 3-bit Example (sign_type = unsigned, positive polarities and cin = 0)Table 6-15. Adder Subtractor Truth Table — Three-bit, Unsigned, PositivePolarities, cin=0din0 din1 addsub dout cout000 010 1 010 0001 010 1 011 0010 010 1 100 0110<strong>ModuleWare</strong> <strong>Reference</strong> Manual, Library Version 1.9September 18, 2008

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!