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.

how to create a customized array and running a counter through it?

Status
Not open for further replies.

sandy3129

Member level 3
Joined
Nov 7, 2014
Messages
56
Helped
1
Reputation
2
Reaction score
1
Trophy points
8
Activity points
445
hello every one , i want to create an array with size A[128x4], in which A[1] consisting of only 128 elements, A[2] consisting of 32 elements, A[3] consisting of 8 elements, A[4] consisting of 2 elements, i want to run a (m = 1:256) bit counter through my array in a way that after filling my 128 elements in A[1] it goes onto fill the A[2] ..... i want to collect my output at from second element from A[4] array, it will be even better if the array shift after receiving a incremental feedback((i.e receiving on feedback as '2' the counter goes to A[2] array, receiving feedback as '3' the counter goes to the A[3] array to it an so on)). kindly guide me with it, thank you.

_20160225_143953.JPG
 

it will be even better if the array shift after receiving a incremental feedback
Either you have no clue what you want to achieve or you are describing too vague. Please try to specify the intended operation clearly.
 
Agreed - and it isn't even clear if this is a software or hardware question. If it's software we need to know what language.

If it's software, maybe a structure of 128 bits, 32 bits, 8 bits and 2 bits (16 bytes, 4 bytes, 1 byte and 1 byte partially used) would work.

Brian.
 

90 percent of the "digital signal processing" posts are asking for help with Matlab code, I guess also the present one.
 

my question is in matlab language only

- - - Updated - - -

all im trying to ask is i want to perform an counter operation of 256, which fills only 128 elements in A[1], and 32 elements in A[2] and 8 elements in A[3] and 2 elements in A[4], sir, thats my expected answer , i even drawed the sequence how it has to come

- - - Updated - - -

the coding to be done in matlab language
 

The drawing suggest a shift operation, but once you mentioned "counter", should we assume that the overflow of each counter will trigger increment of the subsequent one in the chain ? Anyway, It is expected that you post your code, otherwise you have to get the first steps on that language.
 
i am running counter m =1:256;

im passing it to an array array A= cell(1,4);
A[1] = is a (128x1) array.
A[2] = is a (32x1) array.
A[3] = is a (8x1) array.
A[4] = is a (2x1) array.

im passing my input to first element of the A[1] and collecting from the second element of the A[4] array. as SHOWN IN THE FIGURE.

after filling 128 elements in A[1] the input is passed through A[2]. AND SO ON , im going to collect my output from second element of A[4].

- - - Updated - - -

i have made some random thoughts on my code , pls correct me in this.

Code:
N= 256;  %% counter size
A = cell(1,4); %%  four cell arrays 

for m =1:N %% counts
for level = 1:numel(A) %% incremental feedback
           
              A((N/(4^(level-1)))/2)=0; %% when level 1 = it creates 128 bit size, for level =2 ,32bit size,
            %% similarly  when  level =3,8bit,when level= 4, it creates 2 bit size. 
            
              A(1) = m; %% giving an input to the A[1] of the first cell
            
              A =  circshift(A,[0,-1]); %%shifting operation
            
                output=A; %% output collecting 

end
end
 
Last edited by a moderator:

The Cell() function creates a n-dimensional array, but if I understood correctly, you want create a linear array. Anyway, you had still not answered what was asked in post #6.
 

@andre_teprom: sorry then my mistake cell shouldn't be used..,"should we assume that the overflow of each counter will trigger increment of the subsequent one in the chain"!!!!, there is only one counter(256 bit), when the counter fills all the elements of A[1](i.e of 128 elements)after filling it, its gets the trigger then the counter continues to fill the array A[2].

i have tried in one method using "cell"
Code:
N= 16;  %% counter size
A = cell(1,2); %%  four cell arrays 
A{1,1}(8) =0 ;
A{1,2}(2) = 0;
 .
    for m=1:16
     A{1,1}(1) = m
      A{1,1} = circshift(A{1,1},[0,1])
      A{1,2}(1) = A{1,1}(8)
      A{1,2} = circshift(A{1,2},[0,1])
      output = A{1,2}(2)
    end

i got my ans for 16 bit, thanku all, will try to think for my specifications :)
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top