From 801eb7dc200b2974ac26143924aab9e1a11a79e3 Mon Sep 17 00:00:00 2001 From: adam Date: Thu, 21 Aug 2008 11:30:34 +0100 Subject: [PATCH] improve instruction dispatch code in Parser.java --- src/edu/berkeley/fleet/assembler/Parser.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/edu/berkeley/fleet/assembler/Parser.java b/src/edu/berkeley/fleet/assembler/Parser.java index 5843110..c4dc3c3 100644 --- a/src/edu/berkeley/fleet/assembler/Parser.java +++ b/src/edu/berkeley/fleet/assembler/Parser.java @@ -166,8 +166,20 @@ public class Parser { ret.add(wait(inCBD)); ret.add(deliver(inCBD)); ret.add(sendto(out, out.getPath(inCBD.getDataDestination(),null))); - ret.add(new Instruction.Set(ihorn, false, IgnoreOLC, SetDest.InnerLoopCounter, SetSource.Infinity)); - ret.add(new Instruction.Move(ihorn, false, IgnoreOLC, false, null,false,true,true,true,true,false)); + + int count = (int)FleetTwoFleet.CBD_SIZE.getval(startcbd); + // FIXME FIXME FIXME! + int MAX_ILC = 31; + int num_instrs = 0; + while(count > 0) { + int num = Math.min(count, MAX_ILC); + num_instrs+=2; + count -= num; + ret.add(new Instruction.Set(ihorn, false, IgnoreOLC, SetDest.InnerLoopCounter, num)); + ret.add(new Instruction.Move(ihorn, false, IgnoreOLC, false, null,false,true,true,true,true,false)); + } + if (num_instrs > ihorn.getInstructionFifoSize()) throw new RuntimeException(); + return (Instruction[])ret.toArray(new Instruction[0]); } -- 1.7.10.4