[quirks-uvm-devel] query on quirks examples
Status: Pre-Alpha
Brought to you by:
teodor
From: Bhavani M. <bha...@ya...> - 2002-03-29 14:16:19
|
> Date: Thu, 28 Mar 2002 14:00:09 -0800 (PST) > From: bhavmus m <bh...@ya...> > Subject: query on quirks examples > To: qui...@li... > > > Hi, > > I have got the following questions after going > through the simple example. > > > 1. usage of fp[0], fp[1] is little bit confusing. I > am thinking these are the procedure parameters and > can be used for procedure INPUT or OUTPUT > 2. why can not we declare the ct value in the > fact.ua file? > 3. I am able to understand the declaration of > registers, but not the actual mapping done below. > map is > (auMul[1], lv[1]) (auMul[0], fp[0]) (auMul[2], > fp[1]) > end map; > 4. I want to have some more explanation for *act > command. > > 5. I have gone through the fibonacci example too. it > is easy compared to factorial. In this example also > I did n't get the > purpose of mapping lv[3] twice. Why do we need auSum > register, even though we have the actual result in > lv[2]? > > > procedure :Fibonacci is > lv is <int32/inout int32/inout int32/inout > int32/inout stu>; > > declare map > auInc is <int32/out int32/in stu>; > auSum is <int32/in int32/in int32/out stu>; > map is > (lv[3],auInc[0]) > (lv[3],auInc[1]) > (lv[0],auSum[0]) > (lv[1],auSum[1]) > (lv[2],auSum[2]) > end map; > begin > lv[3] <- fp[0]; > lv[0] <- ct[0]; > lv[1] <- ct[1]; > > loop > * auInc; > lv[0] <- lv[1]; > lv[1] <- lv[2]; > until not lv[3]; > > fp[1] <- lv[2]; > > end :Fibonacci; > > > > > > > procedure :fact is > -- Make two 32 bit local registers. > -- Each register is both writeable and readable. > lv is <int32/inout int32/inout stu>; > > declare map > -- Get access to two registers of > incrementer/decrementer > auInc is <int32/out int32/in stu>; > > -- Make two virtual registers (they are simple > "ports" > -- and now they are attached to nothing). > dx1 is <int32/in int32/out stu>; > > -- Three ports of multiplier > auMul is <int32/in int32/in int32/out stu>; > map is > -- Attach fp[0] (it is the first of registers - > parameters > -- of this procedure) to the input register of > incr/decr. > -- The output register of incr/decr attach to the > first local > -- register. > (auInc[0], lv[0]) (auInc[1], fp[0]) > > -- The first local register will contain n-1, > -- the second one will contain the result of > recursive call. > (lv[0], dx1[0]) (lv[1], dx1[1]) > > -- This attach the output of our multiplier (n * > fact (n-1)) > -- to fp[1]. Really fp[x] it is either a memory > cell > -- in the caller stack or a register if our > optimizer is > -- a lassie. It is why it is named "secondary (or > virtual)" > -- selector. Any virtual register is like a > deference. > (auMul[1], lv[1]) (auMul[0], fp[0]) (auMul[2], > fp[1]) > end map; > begin > if fp[0] then > -- It is imperfection of current machine - we need > -- awake decrementor to make its outputs updated. > * auInc; > > -- dx1 will be substituted by fp when th procedure > calls. > -- Theses lv and dx1 will not be able to access > there. > call dx1, :fact; > > -- Synchronize impuls to multiplier > * auMul; > else > -- This branch is for the case of fact(0) = 1. > -- Moves '1' into a register which is "hided" > behind > -- the virtual fp[1]. > fp[1] <- ct[0]; > end if; > > end :fact; > __________________________________________________ Do You Yahoo!? Yahoo! Greetings - send holiday greetings for Easter, Passover http://greetings.yahoo.com/ |