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.

Sequential PartsConfigurable Counter (cntr)In the case of a down counter, if the loaded value is more than the value of the parametermax_count, the counter counts down until 0 and wraps back to the value of the parametermax_count.The output port max always has a value of 1 when the implied value of the parametermax_count is reached. Note that if the counter is counting to the maximum possible value it canhold, it automatically wraps back to 0.Johnson Counter (parameter style = Johnson)In this style, the counting operation is executed by shifting by one bit all except one of the bitsto the left (counting upwards) or right (counting downwards). When counting upwards, the LSBis filled with NOT(MSB) of the counter.When counting downwards, the most significant bit is filled with NOT(LSB) of the counter.Only two choices are available for the parameter max_count; namely all but the MSB is 0(10…) or all but the MSB and MSB-1 are 0 (110…).A HDL generation warning is issued if the value of the parameter max_count is not equal to avalid choice. Note that the value 10… automatically wraps back to 0. It is important to note thatthe value of the parameter max_count does not signify the number of times the counter countsbut it signifies the final bit pattern reached by the counter before wrapping around.The parameter rst_val can be any positive value including a value that the Johnson counterstarting to count from 0 cannot reach.In such a case, the Johnson counter operates with wrong numbers. Any number with bit patterns101 in it is a wrong number for the parameter rst_val. Checking is not performed, allowing theusers to operate in this range of numbers. It is important to note that the behavior of the outputport max does not account for this. Note that an incorrect value can be loaded into the counterthrough the input port din (input port load = 1).If the counter is counting upwards (input port up_dn = 1), a value of 1 is placed in the outputport max if the final bit pattern is reached. If the counter is counting downwards (input portup_dn = 0), a value of 1 is placed in the output port max if the value of the counter is 0.LFSR Counter (parameter style = LFSR)In this style of counting, the counter shifts to the right by 1. The MSB is derived by an algorithmthat depends upon the width of the counter.This algorithm is used to cover all the possible values available as far as possible. The algorithmcan be deciphered by setting the appropriate width on the instance of this counter in the blockdiagram and viewing the HDL. The algorithm usually uses XOR and NOT operations on certainbits of the counters.This style does not support down counting and the input port up_dn is ignored.This counter is very efficient and fast compared to the binary counter. The counter can be usedfor pseudo-random generator, modulo-x counting, or for frequency division. The width of thecounter must be less than 31. Two LFSR counters can be cascaded to achieve larger widths. The180<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!