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)reset value of the counter in this style is statically derived from the parameter rst_val. Theoutput port max is asserted when the value of the counter is 0.One-Hot Counter (parameter style = Onehot)In this style, the counting operation is executed by shifting all the bits to the left by one bit(counting upwards; input port up_dn = 1) or right by one bit (counting downwards; input portup_dn = 0). A HDL generation warning is issued if the value of the parameter rst_val does notconform to one-hot encoding.Note that an illegal value can always be loaded dynamically through input port din (input portload = 1). In such a case, checking is not performed.The behavior of all the other features in the counter assumes that the value of the counter is avalid one-hot value. If the counter is counting upwards, the MSB of the counter is placed in theoutput port max.If the counter is counting downwards, the LSB of the counter is placed in the output port max.One-hot style is very useful to control bus driving logic where only one driver is to be activatedat a time.The value of the parameter rst_val cannot exceed 2 31 - 1. This means that if the width of thecounter is more than 31, bits over 31 are reset to 0. Counters can be cascaded to work aroundthis. The default value for the parameter max_count is 0.Cascading two counters can be done using the value of the output port max. Connect the scalaroutput port max of the first counter to the scalar input port load. Connect the output port countof the second counter to the input port din of the second counter (to feedback the counter value).Adjust the polarity of the output port max of the first counter to ActiveLow (max_type =ActiveLow). In this configuration, the second counter is counting only when the output portmax is 0, that is when the maximum possible value is reached by the first counter, at all othertimes the second counter just feeds back its value to itself.You are advised not to connect the output port max of the first counter to the scalar input portclk_en of the second counter. This connection has a severe hardware cost and can severelyconstrain synthesis tools. The same strategy can be used to cascade more than two counters.Note that cascaded counters can give better performance in the hardware. The maximum size ofthis counter can be set to 2**31.If input ports clk (for asynchronous behavior) is not enabled, the output port count retains itsvalue. The value of the output port max can change with the scalar input port up_dn.Note that, if only the max output is required, the output port count can be disabled using theenumerated parameter count_type (Enabled, Disabled).Function for Binary CounterIf max_count = 0 then (mcount = all bit 1’s (width = width of port count)) else mcount =max_count)where mcount is the implied value of parameter max_count.<strong>ModuleWare</strong> <strong>Reference</strong> Manual, Library Version 1.9 181September 18, 2008

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

Saved successfully!

Ooh no, something went wrong!