[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rep:Re: [f-cpu] I forgot to tell you...



On Thu, Jul 04, 2002 at 06:08:21PM +0200, Yann Guidon wrote:
[...]
> > > - still "in the pipeline" : finish popcount (btw Michael's help
> > >   is welcome because i don't know how to you his generic adders),
> > >   rewrite (mostly) INC, and start BIST.
> > What do you want to add? How big are the operands?
> For the popcount, i have to solve the 4-bit input -> 3 bits ouptut
> logic operation (bit 0 is a AND-reduce and bit 2 is XOR-reduce

Vice versa (assuming that bit 0 is the LSB, as usual).

> but bit 1 is not straight-forward at all). Currently i do it with a
> lookup table in the integer world (that's lame but it should simulate
> fast ;-D). Then there is a row of 8*(3+3=4) adders to make the byte results,
> 4*(4+4=5) adders for the 4 shortint results, 2*(5+5=6) for the two lontgint
> results and a final 6+6=7 adder for the full 64-bit result.

You can use my CIAdd procedure from the Generic_Adder package. Here's
how to use it:

	function "+" (A, B : in std_ulogic_vector) return std_ulogic_vector is
		use work.Generic_Adder.CIAdd;
		constant w : natural := A'length;
		alias aa : std_ulogic_vector(w-1 downto 0) is A;
		alias bb : std_ulogic_vector(w-1 downto 0) is B;
		variable yy, cc : std_ulogic_vector(w-1 downto 0);
		variable pp, gg : std_ulogic;
	begin
		CIAdd(aa, bb, yy, cc, gg, pp);
		-- we only care about yy here
		return yy;
	end "+";

That should work at all operand sizes you need. But note that the
delay will probably be big (d=4...5 per CIAdd), that is, a 64-bit
result will need 4 pipeline stages :( We may reduce that to 3 if the
adders are broken down into their components (CIA_Row and CIA_Inc).

> Currently, i do this with the lame (from memory)
>   subtype type_result6 is integer range 0 to 32;
>   type array_6 is array (1 downto 0) of type_result6;
>   signal tmp_6 : array_6;
> approach with some loops in which i simple perform the addition as is.
> 
> so what i need is entities that perform 3+3, 4+4, 5+5, 6+6 and 7+7,
> that's that simple :-) and the boolean equation of bit 1 of the 4->3 bit
> reduction woud be handy, too.

The sum is 2 or 3, so there must be two or three bits set but not
all four:

	(AB or AC or AD or BC or BD or CD) and not ABCD

if A, B, C and D are the input bits. Bit 2 is, of course, ABCD, so you
already have that part of it, at least. Maybe it becomes cheaper if
you transform it...

-- 
 Michael "Tired" Riepe <Michael.Riepe@stud.uni-hannover.de>
 "All I wanna do is have a little fun before I die"
*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/