Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help me with this counter

Status
Not open for further replies.

kokei74

Junior Member level 3
Joined
Apr 2, 2008
Messages
30
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,528
Im having problem with my counter which will control my storage data in ROM to multiply with another ROM. Both rom will stored matrix data. im having a problem with my counter where it only can count from 0 to 15. For my design i need a counter that need to count from 0 - 3 and repeat counting for 4 times then only it can continue count to 4-7(repeat 4 times to).
example of what it should count is like this..

0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 4 5 6 7 4 5 6 7 4 5 6 7 4 5 6 7 8 9 10 11 ..... until 16

i have attached a figure and hope u can understand my prob.

Hope someone can look into my problem. Thanks.


here is my previous counter.

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;

LIBRARY lpm;
USE lpm.lpm_components.all; --functions

ENTITY CounterA IS
PORT (clock : IN STD_LOGIC;

q : OUT STD_LOGIC_VECTOR(3 DOWNTO 0));
END CounterA;

ARCHITECTURE lpm OF CounterA IS
BEGIN
-- Port map 1
U1: lpm_counter
GENERIC MAP (lpm_width => 4, lpm_direction => "up")

PORT MAP (clock => clock,q => q);


END;
 

Use a counter which counts from 0 - 3.
Everytime it counts to 3 increment a variable say x from 1 till 4;

When variable x reaches 4, add a value of 4 to another variable say y and reset x to 1;


The output of the counter will always add to this variable y to produce a final count.

0 1 2 3 x=1 y=0
0 1 2 3 x=2 y=0
0 1 2 3 x=3 y=0
0 1 2 3 x=4 y=4
4 5 6 7 x=1 y=4
4 5 6 7 x=2 y=4
4 5 6 7 x=3 y=4
4 5 6 7 x=4 y=8

and continue till
8 9 10 11 and 12 13 14 15

General idea. Code you write yourself.
 

Im having trouble coding it myself. :cry:

can u help me code it or give an example on how to it?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top