parametrized design?

  • Thread starter friend.05@gmail.com
  • Start date
F

friend.05@gmail.com

Guest
Hi,

I want to generalise, following expression.


2 input:

out = a | (a & b);


3 input :

out = a | (a & b) | (a & b & c);

4 input :

out = a | (a & b) | (a & b & c) | (a & b & c & d);


How to parameterized this design. Expression goes on increasing as
input increases.
 
On 25 Mar 2006 19:53:35 -0800, "friend.05@gmail.com"
<hirenshah.05@gmail.com> wrote:

Hi,

I want to generalise, following expression.


2 input:

out = a | (a & b);


3 input :

out = a | (a & b) | (a & b & c);

4 input :

out = a | (a & b) | (a & b & c) | (a & b & c & d);


How to parameterized this design. Expression goes on increasing as
input increases.

Unless I am mistaken, you an apply some logic minimisations to get

out = a;


Regards,
Allan
 
function your_expression(in, num);
input [31:0] in;
input [31:0] num;
reg res;
integer i;
begin
res=0;
for(i=0;i<num;i=i+1) begin
res = res | (&in[num:0]);
end
your_expression = res;
end
endfunction

Please be aware of your formula: you are going to get just "out=a".
 
"Michael" <michaelst@gmail.com> wrote in message
news:1143361799.664853.47690@z34g2000cwc.googlegroups.com...
function your_expression(in, num);
input [31:0] in;
input [31:0] num;
reg res;
integer i;
begin
res=0;
for(i=0;i<num;i=i+1) begin
res = res | (&in[num:0]);
Should not that be:
res = res | (&in[i:0]);
?

end
your_expression = res;
end
endfunction

Please be aware of your formula: you are going to get just "out=a".
 
Hi,

How did you find out that "input in" is 32 bits.

Number of Input bit will be changing.

I want to partameterized for input also.
 

Welcome to EDABoard.com

Sponsor

Back
Top