<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
<channel>
  <title>bluespec.com</title>
  <link>http://www.bluespec.com/forum/index.php</link>
  <description>Bluespec Forums</description>
  <language>english</language>
  <copyright>(c) Copyright 2012 by bluespec.com</copyright>
  <managingEditor>support@bluespec.com</managingEditor>
  <webMaster>support@bluespec.com</webMaster>
  <pubDate>Thu May 17, 2012 7:46 am</pubDate>
  <lastBuildDate>Thu May 17, 2012 7:46 am</lastBuildDate>
  <docs>http://backend.userland.com/rss</docs>
  <generator>phpBB2 RSS Syndication Mod by Lucas</generator>
  <ttl>1</ttl>

  <image>
    <title>bluespec.com</title>
    <url></url>
    <link>http://www.bluespec.com/forum/</link>
    <description>Bluespec Forums</description>
  </image>

                                      <item>
                                        <title>Defining HW Constraints in Bluespec</title>
                                        <link>http://www.bluespec.com/forum/viewtopic.php?p=1002#1002</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='http://www.bluespec.com/forum/profile.php?mode=viewprofile&amp;u=1018'&gt;kevin5k&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Thu May 10, 2012 7:13 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      &lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;quark wrote:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;quote&quot;&gt;The Bluespec compiler doesn't work this way.  The compiler isn't making design choices for you; the BSV language gives you complete control over the generated hardware.&lt;br /&gt;
&lt;br /&gt;
If you want your design to only use 4 multipliers, then you would write the BSV source to only use 4 multipliers.  So there are no directives to the compiler.&lt;br /&gt;
&lt;br /&gt;
However, BSV does allow you provide automation, but it is done as part of the language and not as a compiler directive:  If you want the number of multipliers to be a parameter that you can change, then you write the BSV code to be able to support differing numbers of multipliers and have the choice of architecture be chosen by a parameter.  There are various ways to do this: (1) formal arguments to the module, (2) global parameters, (3) preprocessor macros (which can be provided to the compiler command-line).  Options 1 and 2 are common, and there are various ways to go about them, too.&lt;br /&gt;
&lt;br /&gt;
So, for instance, the PAClib library is written to provide convenient parameterized building blocks, to automate work for the designer.  But the automation is written in the code for the PAClib, not by any special directives from the compiler.&lt;br /&gt;
&lt;br /&gt;
If you're using library elements written by someone else, and it has been written with parameters, then you would provide the parameters in the way that they have chosen.&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
quark - Thank you for answering my question and help to clarify my perception on Bluespec's capabilities. Hope my post will be useful for others in a similar situation as me.</description>
                                        <comments>http://www.bluespec.com/forum/viewtopic.php?p=1002#1002</comments>
                                        <author>kevin5k</author>
                                        <pubDate>Thu May 10, 2012 7:13 am</pubDate>
                                        <guid isPermaLink="true">http://www.bluespec.com/forum/viewtopic.php?p=1002#1002</guid>
                                      </item>
                                      <item>
                                        <title>Clock gating BSV library modules</title>
                                        <link>http://www.bluespec.com/forum/viewtopic.php?p=1001#1001</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='http://www.bluespec.com/forum/profile.php?mode=viewprofile&amp;u=12'&gt;ewc&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Wed May 09, 2012 3:32 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Clock gates include more than just CLOCK_GATE ports.  When analyzing the bluespec verilog library, many tool interpret, the EN signal (or ENQ or DEQ, etc) as a clock gate.  If you consider the BRAM.v module , the EN signal is really a clock gate.&lt;br /&gt;
&lt;br /&gt;
If you have a different specification for a BRAM with clock gateing in mind, then you will need to create your own &amp;quot;import BVI&amp;quot; module.&lt;br /&gt;
&lt;br /&gt;
Ed.</description>
                                        <comments>http://www.bluespec.com/forum/viewtopic.php?p=1001#1001</comments>
                                        <author>ewc</author>
                                        <pubDate>Wed May 09, 2012 3:32 pm</pubDate>
                                        <guid isPermaLink="true">http://www.bluespec.com/forum/viewtopic.php?p=1001#1001</guid>
                                      </item>
                                      <item>
                                        <title>Generate bounded random numbers (Randomizable?)</title>
                                        <link>http://www.bluespec.com/forum/viewtopic.php?p=997#997</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='http://www.bluespec.com/forum/profile.php?mode=viewprofile&amp;u=1106'&gt;Mohsen&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Mon Apr 30, 2012 10:47 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Hi hadar_agam,&lt;br /&gt;
&lt;br /&gt;
Thank you so much.&lt;br /&gt;
&lt;br /&gt;
It was extremely helpful.&lt;br /&gt;
&lt;br /&gt;
Regards&lt;br /&gt;
Mohsen</description>
                                        <comments>http://www.bluespec.com/forum/viewtopic.php?p=997#997</comments>
                                        <author>Mohsen</author>
                                        <pubDate>Mon Apr 30, 2012 10:47 am</pubDate>
                                        <guid isPermaLink="true">http://www.bluespec.com/forum/viewtopic.php?p=997#997</guid>
                                      </item>
                                      <item>
                                        <title>2012.01.A BRAMs are no longer inferred by Quartus II</title>
                                        <link>http://www.bluespec.com/forum/viewtopic.php?p=994#994</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='http://www.bluespec.com/forum/profile.php?mode=viewprofile&amp;u=62'&gt;ShepSiegel&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Tue Apr 17, 2012 9:27 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      We observed and reported this on or about Feb 3. It is a thorny issue as the BRAM{1,1BE,2}.v modules provided must not just be IEEE standard Verilog; but they must satisfy the sometimes non-standard inference of the (imperfect, changing) FPGA vendor synthesis tools.&lt;br /&gt;
&lt;br /&gt;
In our case the design &amp;quot;exploded&amp;quot; with Quartus wanting to make registers our of each MRAM word.&lt;br /&gt;
&lt;br /&gt;
We have worked around the issue by using old copies of BRAM{1,1BE,2}.v for Quartus only.  Your mileage may vary.&lt;br /&gt;
&lt;br /&gt;
-Shep</description>
                                        <comments>http://www.bluespec.com/forum/viewtopic.php?p=994#994</comments>
                                        <author>ShepSiegel</author>
                                        <pubDate>Tue Apr 17, 2012 9:27 pm</pubDate>
                                        <guid isPermaLink="true">http://www.bluespec.com/forum/viewtopic.php?p=994#994</guid>
                                      </item>
                                      <item>
                                        <title>Opaque types in interfaces</title>
                                        <link>http://www.bluespec.com/forum/viewtopic.php?p=993#993</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='http://www.bluespec.com/forum/profile.php?mode=viewprofile&amp;u=70'&gt;mcadler&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Tue Apr 17, 2012 3:06 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      I'm trying to break apart the current interface's insert() method into two parts so that the test() and set() are separate pieces.  I could then use test() as a predicate to a rule.&lt;br /&gt;
&lt;br /&gt;
The current interface allows that too, with the notSet() method, at the cost of doing the equivalent of test() twice and crossing fingers that the optimizer will remove the potentially large redundant code from notSet() and insert().&lt;br /&gt;
&lt;br /&gt;
Here is the current code:&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;//&lt;br /&gt;
// Copyright &amp;#40;C&amp;#41; 2009 Intel Corporation&lt;br /&gt;
//&lt;br /&gt;
// This program is free software; you can redistribute it and/or&lt;br /&gt;
// modify it under the terms of the GNU General Public License&lt;br /&gt;
// as published by the Free Software Foundation; either version 2&lt;br /&gt;
// of the License, or &amp;#40;at your option&amp;#41; any later version.&lt;br /&gt;
//&lt;br /&gt;
// This program is distributed in the hope that it will be useful,&lt;br /&gt;
// but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.&amp;nbsp; See the&lt;br /&gt;
// GNU General Public License for more details.&lt;br /&gt;
//&lt;br /&gt;
// You should have received a copy of the GNU General Public License&lt;br /&gt;
// along with this program; if not, write to the Free Software&lt;br /&gt;
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA&amp;nbsp; 02110-1301, USA.&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
// Library imports.&lt;br /&gt;
&lt;br /&gt;
import Vector&amp;#58;&amp;#58;*;&lt;br /&gt;
import RWire&amp;#58;&amp;#58;*;&lt;br /&gt;
&lt;br /&gt;
//&lt;br /&gt;
// Counting filters can be used to determine whether an entry is present in&lt;br /&gt;
// a set.&amp;nbsp; All counting filters have both insert&amp;#40;&amp;#41; and remove&amp;#40;&amp;#41; methods.&lt;br /&gt;
// This module provides multiple implementations for sets of varying sizes.&lt;br /&gt;
// Smaller sets can use direct decode filters.&amp;nbsp; Larger sets can use Bloom&lt;br /&gt;
// filters, which have more logic to deal with hashes but have good false&lt;br /&gt;
// positive rates with relatively small filter vector sizes.&lt;br /&gt;
//&lt;br /&gt;
// For automatic selection of a reasonable filter, use the mkCountingFilter&lt;br /&gt;
// module.&amp;nbsp; It picks decode filters for smaller sets and Bloom filters for&lt;br /&gt;
// larger sets.&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ========================================================================&lt;br /&gt;
&lt;br /&gt;
// COUNTING_FILTER&lt;br /&gt;
//&lt;br /&gt;
//&amp;nbsp; &amp;nbsp;All counting filters provide this basic interface.&lt;br /&gt;
//&lt;br /&gt;
// ========================================================================&lt;br /&gt;
&lt;br /&gt;
interface COUNTING_FILTER#&amp;#40;type t_ENTRY&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // Clear filter&lt;br /&gt;
&amp;nbsp; &amp;nbsp; method Action reset&amp;#40;&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // Attempt to insert a new entry.&amp;nbsp; Returns true on success.&amp;nbsp; If the filter&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // already has the entry or a counter would overflow returns false.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; method ActionValue#&amp;#40;Bool&amp;#41; insert&amp;#40;t_ENTRY newEntry&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; method Action remove&amp;#40;t_ENTRY oldEntry&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // Test whether entry is busy&lt;br /&gt;
&amp;nbsp; &amp;nbsp; method Bool notSet&amp;#40;t_ENTRY entry&amp;#41;;&lt;br /&gt;
endinterface&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//&lt;br /&gt;
// mkCountingFilter --&lt;br /&gt;
//&amp;nbsp; &amp;nbsp;Pick a reasonable filter based on the entry set size.&amp;nbsp; Uses a Bloom filter&lt;br /&gt;
//&amp;nbsp; &amp;nbsp;for large sets and a simple decode filter for smaller sets.&lt;br /&gt;
//&lt;br /&gt;
//&amp;nbsp; &amp;nbsp;If allowComplexFilters is true then larger filters, such as Bloom filters,&lt;br /&gt;
//&amp;nbsp; &amp;nbsp;may be allocated.&amp;nbsp; If allowComplexFilters is false then only decode filters&lt;br /&gt;
//&amp;nbsp; &amp;nbsp;will be allocated.&lt;br /&gt;
//&lt;br /&gt;
module mkCountingFilter#&amp;#40;Bool allowComplexFilters, DEBUG_FILE debugLog&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // interface&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#40;COUNTING_FILTER#&amp;#40;t_ENTRY&amp;#41;&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; provisos &amp;#40;Bits#&amp;#40;t_ENTRY, t_ENTRY_SZ&amp;#41;&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; let filter = ?;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if &amp;#40;&amp;#40;valueOf&amp;#40;t_ENTRY_SZ&amp;#41; &amp;gt; 10&amp;#41; &amp;amp;&amp;amp; allowComplexFilters&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; begin&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Large sets use Bloom filters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; COUNTING_BLOOM_FILTER#&amp;#40;t_ENTRY, 128, 2&amp;#41; bloomFilter &amp;lt;- mkCountingBloomFilter&amp;#40;debugLog&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; filter = bloomFilter.countingFilterIfc;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&amp;nbsp; &amp;nbsp; else if &amp;#40;valueOf&amp;#40;t_ENTRY_SZ&amp;#41; &amp;gt; 7&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; begin&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Medium sized sets share 2 bits per entry&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DECODE_FILTER#&amp;#40;t_ENTRY, TDiv#&amp;#40;TExp#&amp;#40;t_ENTRY_SZ&amp;#41;, 2&amp;#41;&amp;#41; decodeFilterL &amp;lt;- mkSizedDecodeFilter&amp;#40;debugLog&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; filter = decodeFilterL.countingFilterIfc;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; begin&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Small sets get unique bit per entry&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DECODE_FILTER#&amp;#40;t_ENTRY, TExp#&amp;#40;t_ENTRY_SZ&amp;#41;&amp;#41; decodeFilterS &amp;lt;- mkSizedDecodeFilter&amp;#40;debugLog&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; filter = decodeFilterS.countingFilterIfc;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; return filter;&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ========================================================================&lt;br /&gt;
//&lt;br /&gt;
// Decode Filter&lt;br /&gt;
//&lt;br /&gt;
// ========================================================================&lt;br /&gt;
&lt;br /&gt;
//&lt;br /&gt;
// nFilterBits should be a power of 2!&amp;nbsp; Decode filter exposes&lt;br /&gt;
// a counting filter interface for compatibility with the Bloom&lt;br /&gt;
// filter.&lt;br /&gt;
//&lt;br /&gt;
interface DECODE_FILTER#&amp;#40;type t_ENTRY, numeric type nFilterBits&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; interface COUNTING_FILTER#&amp;#40;t_ENTRY&amp;#41; countingFilterIfc;&lt;br /&gt;
endinterface&lt;br /&gt;
&lt;br /&gt;
//&lt;br /&gt;
// Decode filter with one bit corresponding to one or more entries.&lt;br /&gt;
// Insert and remove methods may both be called in the same cycle.&lt;br /&gt;
//&lt;br /&gt;
module mkSizedDecodeFilter#&amp;#40;DEBUG_FILE debugLog&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // interface&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#40;DECODE_FILTER#&amp;#40;t_ENTRY, nFilterBits&amp;#41;&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; provisos &amp;#40;Bits#&amp;#40;t_ENTRY, t_ENTRY_SZ&amp;#41;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Alias#&amp;#40;Bit#&amp;#40;TLog#&amp;#40;nFilterBits&amp;#41;&amp;#41;, t_FILTER_IDX&amp;#41;&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Reg#&amp;#40;Bit#&amp;#40;nFilterBits&amp;#41;&amp;#41; fv &amp;lt;- mkReg&amp;#40;0&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; RWire#&amp;#40;t_FILTER_IDX&amp;#41; insertId &amp;lt;- mkRWire&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; RWire#&amp;#40;t_FILTER_IDX&amp;#41; removeId &amp;lt;- mkRWire&amp;#40;&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Reg#&amp;#40;Maybe#&amp;#40;t_ENTRY&amp;#41;&amp;#41; lastFailMsg &amp;lt;- mkReg&amp;#40;tagged Invalid&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; function t_FILTER_IDX filterIdx&amp;#40;t_ENTRY e&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return truncateNP&amp;#40;pack&amp;#40;e&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; endfunction&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#40;* fire_when_enabled *&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; rule updateFilter &amp;#40;True&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; let fv_new = fv;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &amp;#40;insertId.wget&amp;#40;&amp;#41; matches tagged Valid .id&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fv_new&amp;#91;id&amp;#93; = 1;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &amp;#40;removeId.wget&amp;#40;&amp;#41; matches tagged Valid .id&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fv_new&amp;#91;id&amp;#93; = 0;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fv &amp;lt;= fv_new;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; endrule&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; interface COUNTING_FILTER countingFilterIfc;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; method Action reset&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fv &amp;lt;= 0;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; endmethod&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; method ActionValue#&amp;#40;Bool&amp;#41; insert&amp;#40;t_ENTRY newEntry&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; let id = filterIdx&amp;#40;newEntry&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &amp;#40;fv&amp;#91;id&amp;#93; == 0&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; begin&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; insertId.wset&amp;#40;id&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lastFailMsg &amp;lt;= tagged Invalid;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; debugLog.record&amp;#40;$format&amp;#40;&amp;quot;&amp;nbsp; &amp;nbsp; Decode filter INSERT %0d OK, idx=%0d&amp;quot;, newEntry, id&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return True;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; begin&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Only print insert FAIL message once&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &amp;#40;! isValid&amp;#40;lastFailMsg&amp;#41; || &amp;#40;pack&amp;#40;newEntry&amp;#41; != pack&amp;#40;validValue&amp;#40;lastFailMsg&amp;#41;&amp;#41;&amp;#41;&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; begin&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lastFailMsg &amp;lt;= tagged Valid newEntry;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; debugLog.record&amp;#40;$format&amp;#40;&amp;quot;&amp;nbsp; &amp;nbsp; Decode filter INSERT %0d FAIL, idx=%0d&amp;quot;, newEntry, id&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return False;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; endmethod&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; method Action remove&amp;#40;t_ENTRY oldEntry&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; let id = filterIdx&amp;#40;oldEntry&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; removeId.wset&amp;#40;id&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; debugLog.record&amp;#40;$format&amp;#40;&amp;quot;&amp;nbsp; &amp;nbsp; Decode filter REMOVE %0d, idx=%0d&amp;quot;, oldEntry, id&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; endmethod&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; method Bool notSet&amp;#40;t_ENTRY entry&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; let id = filterIdx&amp;#40;entry&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return &amp;#40;fv&amp;#91;id&amp;#93; == 0&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; endmethod&lt;br /&gt;
&amp;nbsp; &amp;nbsp; endinterface&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ========================================================================&lt;br /&gt;
//&lt;br /&gt;
// Counting Bloom Filter&lt;br /&gt;
//&lt;br /&gt;
// ========================================================================&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
interface COUNTING_BLOOM_FILTER#&amp;#40;type t_ENTRY,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;numeric type nFilterBits,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;numeric type nCounterBits&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; interface COUNTING_FILTER#&amp;#40;t_ENTRY&amp;#41; countingFilterIfc;&lt;br /&gt;
endinterface&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
typedef Vector#&amp;#40;nHashes, Bit#&amp;#40;nHashIndexBits&amp;#41;&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; BLOOM_FILTER_HASH_VEC#&amp;#40;numeric type nHashes, numeric type nHashIndexBits&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
//&lt;br /&gt;
// Optimal number of hashes is probably 5 or 6, but that takes too much FPGA&lt;br /&gt;
// space.&lt;br /&gt;
//&lt;br /&gt;
typedef 4 BLOOM_COUNTING_HASHES;&lt;br /&gt;
&lt;br /&gt;
//&lt;br /&gt;
// Counting Bloom filter up to 256 bits.&lt;br /&gt;
//&lt;br /&gt;
module mkCountingBloomFilter#&amp;#40;DEBUG_FILE debugLog&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // interface&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#40;COUNTING_BLOOM_FILTER#&amp;#40;t_ENTRY, nFilterBits, nCounterBits&amp;#41;&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; provisos &amp;#40;Bits#&amp;#40;t_ENTRY, t_ENTRY_SZ&amp;#41;,&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // nFilterBits must be &amp;lt;= 256 and a power of 2.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Add#&amp;#40;TLog#&amp;#40;nFilterBits&amp;#41;, a__, 8&amp;#41;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Add#&amp;#40;nFilterBits, 0, TExp#&amp;#40;TLog#&amp;#40;nFilterBits&amp;#41;&amp;#41;&amp;#41;,&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Alias#&amp;#40;BLOOM_FILTER_HASH_VEC#&amp;#40;BLOOM_COUNTING_HASHES, TLog#&amp;#40;nFilterBits&amp;#41;&amp;#41;, t_HASH_VEC&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; // Filter bits &amp;#40;counters&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Reg#&amp;#40;Vector#&amp;#40;nFilterBits, Bit#&amp;#40;nCounterBits&amp;#41;&amp;#41;&amp;#41; bf &amp;lt;- mkReg&amp;#40;replicate&amp;#40;0&amp;#41;&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // Insert and remove requests are passed on wires to a single rule so&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // both methods may be called in the same cycle.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; RWire#&amp;#40;t_HASH_VEC&amp;#41; insertVec &amp;lt;- mkRWire&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; RWire#&amp;#40;t_ENTRY&amp;#41; removeId &amp;lt;- mkRWire&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; RWire#&amp;#40;Tuple2#&amp;#40;Bit#&amp;#40;nFilterBits&amp;#41;, Bit#&amp;#40;nFilterBits&amp;#41;&amp;#41;&amp;#41; updateBits &amp;lt;- mkRWire&amp;#40;&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Reg#&amp;#40;Maybe#&amp;#40;t_ENTRY&amp;#41;&amp;#41; lastFailMsg &amp;lt;- mkReg&amp;#40;tagged Invalid&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; //&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // computeHashes --&lt;br /&gt;
&amp;nbsp; &amp;nbsp; //&amp;nbsp; &amp;nbsp; &amp;nbsp;Calculate the set of hashes for an entry id.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; //&lt;br /&gt;
&amp;nbsp; &amp;nbsp; function t_HASH_VEC computeHashes&amp;#40;t_ENTRY entryId&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Map however many entry bits there are to 32 bits.&amp;nbsp; This hash function&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // is a compromise for FPGA area.&amp;nbsp; It works well for current functional&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // memory set sizes.&amp;nbsp; We may need to revisit it later.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Bit#&amp;#40;32&amp;#41; idx32;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Bit#&amp;#40;t_ENTRY_SZ&amp;#41; idx_orig = pack&amp;#40;entryId&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Integer b = 0;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for &amp;#40;Integer i = 0; i &amp;lt; 32; i = i + 1&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; begin&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; idx32&amp;#91;i&amp;#93; = idx_orig&amp;#91;b&amp;#93;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; b = b + 1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &amp;#40;b == valueOf&amp;#40;t_ENTRY_SZ&amp;#41;&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; b = 0;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Get four 8 bit hashes&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; t_HASH_VEC hash = newVector&amp;#40;&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; hash&amp;#91;0&amp;#93; = truncate&amp;#40;hash8&amp;#40;idx32&amp;#91;7&amp;#58;0&amp;#93;&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; hash&amp;#91;1&amp;#93; = truncate&amp;#40;hash8a&amp;#40;idx32&amp;#91;15&amp;#58;8&amp;#93;&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; hash&amp;#91;2&amp;#93; = truncate&amp;#40;hash8b&amp;#40;idx32&amp;#91;23&amp;#58;16&amp;#93;&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; hash&amp;#91;3&amp;#93; = truncate&amp;#40;hash8c&amp;#40;idx32&amp;#91;31&amp;#58;24&amp;#93;&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return hash;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; endfunction&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; //&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // updateFilter --&lt;br /&gt;
&amp;nbsp; &amp;nbsp; //&lt;br /&gt;
&amp;nbsp; &amp;nbsp; //&amp;nbsp; &amp;nbsp; &amp;nbsp;Two part, single cycle rule to update the Bloom filter.&amp;nbsp; The&lt;br /&gt;
&amp;nbsp; &amp;nbsp; //&amp;nbsp; &amp;nbsp; &amp;nbsp;first rule consumes this cycle's insert and remove calls and constructs&lt;br /&gt;
&amp;nbsp; &amp;nbsp; //&amp;nbsp; &amp;nbsp; &amp;nbsp;a pair of vectors of filter positions that will change.&amp;nbsp; The second&lt;br /&gt;
&amp;nbsp; &amp;nbsp; //&amp;nbsp; &amp;nbsp; &amp;nbsp;rule consumes those vectors as wires and updates the Bloom filter.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; //&lt;br /&gt;
&amp;nbsp; &amp;nbsp; //&amp;nbsp; &amp;nbsp; &amp;nbsp;While these rules are logically a single rule, combining them causes&lt;br /&gt;
&amp;nbsp; &amp;nbsp; //&amp;nbsp; &amp;nbsp; &amp;nbsp;the Bluespec optimizer to attempt to figure out exactly which bits&lt;br /&gt;
&amp;nbsp; &amp;nbsp; //&amp;nbsp; &amp;nbsp; &amp;nbsp;changed and the combinatorics grow quite large.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; //&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#40;* fire_when_enabled *&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; rule updateFilter1 &amp;#40;True&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Construct a vector of filter positions to increment.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Bit#&amp;#40;nFilterBits&amp;#41; bf_up = 0;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &amp;#40;insertVec.wget&amp;#40;&amp;#41; matches tagged Valid .hash&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; begin&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for &amp;#40;Integer i = 0; i &amp;lt; valueOf&amp;#40;BLOOM_COUNTING_HASHES&amp;#41;; i = i + 1&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; begin&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bf_up&amp;#91;hash&amp;#91;i&amp;#93;&amp;#93; = 1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Construct a vector of filter positions to decrement.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Bit#&amp;#40;nFilterBits&amp;#41; bf_down = 0;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Removal request comes in as the index to the filter instead of a&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // set of hash buckets.&amp;nbsp; This puts the computation of hashes in a single&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // rule.&amp;nbsp; We would do this for the insert request, too, except that&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // the insert method returns a response that is a function of the hashes.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &amp;#40;removeId.wget&amp;#40;&amp;#41; matches tagged Valid .remId&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; begin&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; let hash = computeHashes&amp;#40;remId&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for &amp;#40;Integer i = 0; i &amp;lt; valueOf&amp;#40;BLOOM_COUNTING_HASHES&amp;#41;; i = i + 1&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; begin&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bf_down&amp;#91;hash&amp;#91;i&amp;#93;&amp;#93; = 1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; debugLog.record&amp;#40;$format&amp;#40;&amp;quot;&amp;nbsp; &amp;nbsp; Bloom filter REMOVE input state, id=0x%x&amp;#58; %0d &amp;#40;%0d&amp;#41;, %0d &amp;#40;%0d&amp;#41;, %0d &amp;#40;%0d&amp;#41;, %0d &amp;#40;%0d&amp;#41;&amp;quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; remId,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; hash&amp;#91;0&amp;#93;, bf&amp;#91;hash&amp;#91;0&amp;#93;&amp;#93;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; hash&amp;#91;1&amp;#93;, bf&amp;#91;hash&amp;#91;1&amp;#93;&amp;#93;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; hash&amp;#91;2&amp;#93;, bf&amp;#91;hash&amp;#91;2&amp;#93;&amp;#93;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; hash&amp;#91;3&amp;#93;, bf&amp;#91;hash&amp;#91;3&amp;#93;&amp;#93;&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Pass the update vectors to the next rule &amp;#40;same cycle&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; updateBits.wset&amp;#40;tuple2&amp;#40;bf_up, bf_down&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; endrule&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#40;* fire_when_enabled *&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; rule updateFilter2 &amp;#40;True&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Consume the result of updateFilter1 and update the Bloom filter.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &amp;#40;updateBits.wget&amp;#40;&amp;#41; matches tagged Valid &amp;#123;.bf_up, .bf_down&amp;#125;&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; begin&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Vector#&amp;#40;nFilterBits, Bit#&amp;#40;nCounterBits&amp;#41;&amp;#41; bf_new;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // A filter slot changes if only one of up and down is requested&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; let bf_changes = bf_up ^ bf_down;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for &amp;#40;Integer i = 0; i &amp;lt; valueOf&amp;#40;nFilterBits&amp;#41;; i = i + 1&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; begin&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &amp;#40;bf_changes&amp;#91;i&amp;#93; == 1&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Position gets new value&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bf_new&amp;#91;i&amp;#93; = bf&amp;#91;i&amp;#93; + &amp;#40;&amp;#40;bf_up&amp;#91;i&amp;#93; == 1&amp;#41; ? 1 &amp;#58; -1&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Position unchanged&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bf_new&amp;#91;i&amp;#93; = bf&amp;#91;i&amp;#93;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bf &amp;lt;= bf_new;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&amp;nbsp; &amp;nbsp; endrule&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; interface COUNTING_FILTER countingFilterIfc;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; method Action reset&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bf &amp;lt;= replicate&amp;#40;0&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; endmethod&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; method ActionValue#&amp;#40;Bool&amp;#41; insert&amp;#40;t_ENTRY newEntry&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; let hash = computeHashes&amp;#40;newEntry&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Update counters for the hashes.&amp;nbsp; Compute two properties&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&amp;nbsp; &amp;nbsp;all_set --&amp;nbsp; True iff all hashes were already set in the filter,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;indicating the index is already present.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&amp;nbsp; &amp;nbsp;overflow -- True iff any counter would overflow.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Bool all_set = True;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Bool overflow = False;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; debugLog.record&amp;#40;$format&amp;#40;&amp;quot;&amp;nbsp; &amp;nbsp; Bloom filter INSERT input state, id=0x%x&amp;#58; %0d &amp;#40;%0d&amp;#41;, %0d &amp;#40;%0d&amp;#41;, %0d &amp;#40;%0d&amp;#41;, %0d &amp;#40;%0d&amp;#41;&amp;quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; newEntry,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; hash&amp;#91;0&amp;#93;, bf&amp;#91;hash&amp;#91;0&amp;#93;&amp;#93;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; hash&amp;#91;1&amp;#93;, bf&amp;#91;hash&amp;#91;1&amp;#93;&amp;#93;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; hash&amp;#91;2&amp;#93;, bf&amp;#91;hash&amp;#91;2&amp;#93;&amp;#93;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; hash&amp;#91;3&amp;#93;, bf&amp;#91;hash&amp;#91;3&amp;#93;&amp;#93;&amp;#41;&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for &amp;#40;Integer i = 0; i &amp;lt; valueOf&amp;#40;BLOOM_COUNTING_HASHES&amp;#41;; i = i + 1&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; begin&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; let bucket = hash&amp;#91;i&amp;#93;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; all_set = all_set &amp;amp;&amp;amp; &amp;#40;bf&amp;#91;bucket&amp;#93; != 0&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; let new_count = bf&amp;#91;bucket&amp;#93; + 1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; overflow = overflow || &amp;#40;new_count == 0&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &amp;#40;new_count == 0&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; debugLog.record&amp;#40;$format&amp;#40;&amp;quot;&amp;nbsp; &amp;nbsp; Bloom filter bucket %0d overflow&amp;quot;, bucket&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &amp;#40;all_set || overflow&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; begin&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Can't insert.&amp;nbsp; Only print insert FAIL message once.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &amp;#40;! isValid&amp;#40;lastFailMsg&amp;#41; || &amp;#40;pack&amp;#40;newEntry&amp;#41; != pack&amp;#40;validValue&amp;#40;lastFailMsg&amp;#41;&amp;#41;&amp;#41;&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; begin&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lastFailMsg &amp;lt;= tagged Valid newEntry;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; debugLog.record&amp;#40;$format&amp;#40;&amp;quot;&amp;nbsp; &amp;nbsp; Bloom filter INSERT FAIL&amp;quot;&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return False;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; begin&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; debugLog.record&amp;#40;$format&amp;#40;&amp;quot;&amp;nbsp; &amp;nbsp; Bloom filter INSERT OK&amp;quot;&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lastFailMsg &amp;lt;= tagged Invalid;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; insertVec.wset&amp;#40;hash&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return True;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; endmethod&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; method Action remove&amp;#40;t_ENTRY oldEntry&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; removeId.wset&amp;#40;oldEntry&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; endmethod&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; method Bool notSet&amp;#40;t_ENTRY entry&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; let hash = computeHashes&amp;#40;entry&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Bool all_set = True;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for &amp;#40;Integer i = 0; i &amp;lt; valueOf&amp;#40;BLOOM_COUNTING_HASHES&amp;#41;; i = i + 1&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; begin&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; let bucket = hash&amp;#91;i&amp;#93;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; all_set = all_set &amp;amp;&amp;amp; &amp;#40;bf&amp;#91;bucket&amp;#93; != 0&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Entry is busy iff all hash bits are set&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ! all_set;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; endmethod&lt;br /&gt;
&amp;nbsp; &amp;nbsp; endinterface&lt;br /&gt;
endmodule&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;</description>
                                        <comments>http://www.bluespec.com/forum/viewtopic.php?p=993#993</comments>
                                        <author>mcadler</author>
                                        <pubDate>Tue Apr 17, 2012 3:06 pm</pubDate>
                                        <guid isPermaLink="true">http://www.bluespec.com/forum/viewtopic.php?p=993#993</guid>
                                      </item>
                                      <item>
                                        <title>Synthesis boundary between BVI wrapper and the Verilog</title>
                                        <link>http://www.bluespec.com/forum/viewtopic.php?p=987#987</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='http://www.bluespec.com/forum/profile.php?mode=viewprofile&amp;u=928'&gt;rasha&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Sun Apr 15, 2012 8:47 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Hello;&lt;br /&gt;
&lt;br /&gt;
My general question is about FPGA/ASIC synthesis from Bluespec code.&lt;br /&gt;
Is there any preferred/suggested code structure/organization for facilitating this step?&lt;br /&gt;
&lt;br /&gt;
In my specific case, this is what I'd like to do:&lt;br /&gt;
&lt;br /&gt;
I want to write a &amp;quot;partial BVI wrapper&amp;quot;. Let's say I have an UART, and I want to wrap only the &amp;quot;parallel side&amp;quot;, so that it connects seamlessly to my Bluespec code. However, I want to leave the serial side (serialIn, serialOut) &amp;quot;exposed&amp;quot; in Verilog and accessible for routing constraint files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(Note: I have matching &amp;quot;full BVI wrappers&amp;quot; for testing within BSV flow.)&lt;br /&gt;
&lt;br /&gt;
Is something like this possible or is there a standard way this is done?</description>
                                        <comments>http://www.bluespec.com/forum/viewtopic.php?p=987#987</comments>
                                        <author>rasha</author>
                                        <pubDate>Sun Apr 15, 2012 8:47 pm</pubDate>
                                        <guid isPermaLink="true">http://www.bluespec.com/forum/viewtopic.php?p=987#987</guid>
                                      </item>
                                      <item>
                                        <title>BSV syntax coloring template for Gedit (GNU/Linux)</title>
                                        <link>http://www.bluespec.com/forum/viewtopic.php?p=986#986</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='http://www.bluespec.com/forum/profile.php?mode=viewprofile&amp;u=964'&gt;comododragon&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Sun Apr 15, 2012 12:51 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      For those who are using gtksourceview-3.0, a change must me made, since the syntax of comments on C language has changed:&lt;br /&gt;
&lt;br /&gt;
Locate those two lines below:&lt;br /&gt;
        &amp;lt;context ref=&amp;quot;c:comment&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;context ref=&amp;quot;c:comment-multiline&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change for:&lt;br /&gt;
        &amp;lt;context ref=&amp;quot;def:c-like-comment&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;context ref=&amp;quot;def:c-like-comment-multiline&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I have found those two lines in the file /usr/share/gtksourceview-3.0/language-specs/c.lang&lt;br /&gt;
&lt;br /&gt;
Good programming!</description>
                                        <comments>http://www.bluespec.com/forum/viewtopic.php?p=986#986</comments>
                                        <author>comododragon</author>
                                        <pubDate>Sun Apr 15, 2012 12:51 pm</pubDate>
                                        <guid isPermaLink="true">http://www.bluespec.com/forum/viewtopic.php?p=986#986</guid>
                                      </item>
                                      <item>
                                        <title>Indexing an array of BRAMs question</title>
                                        <link>http://www.bluespec.com/forum/viewtopic.php?p=984#984</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='http://www.bluespec.com/forum/profile.php?mode=viewprofile&amp;u=964'&gt;comododragon&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Sat Apr 14, 2012 1:10 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      I wasn't using this flag, thank you!&lt;br /&gt;
&lt;br /&gt;
But, in the meantime, i've solved my problem by changing from BRAMServer to BRAMCore...</description>
                                        <comments>http://www.bluespec.com/forum/viewtopic.php?p=984#984</comments>
                                        <author>comododragon</author>
                                        <pubDate>Sat Apr 14, 2012 1:10 am</pubDate>
                                        <guid isPermaLink="true">http://www.bluespec.com/forum/viewtopic.php?p=984#984</guid>
                                      </item>
                                      <item>
                                        <title>Using Vectors of Wires and interface methods</title>
                                        <link>http://www.bluespec.com/forum/viewtopic.php?p=981#981</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='http://www.bluespec.com/forum/profile.php?mode=viewprofile&amp;u=806'&gt;anthony_unisa&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Thu Apr 12, 2012 6:10 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      During my attempts at solving the issue I came across the readReg function and was thinking &amp;quot;this is almost what I need, but I need vector support&amp;quot;. As you've pointed out, turns out there is such a function in readVReg which is exactly what I required (didn't look in the reference manual hard enough:)) A belated reply of thanks for your prompt and comprehensive answer!</description>
                                        <comments>http://www.bluespec.com/forum/viewtopic.php?p=981#981</comments>
                                        <author>anthony_unisa</author>
                                        <pubDate>Thu Apr 12, 2012 6:10 pm</pubDate>
                                        <guid isPermaLink="true">http://www.bluespec.com/forum/viewtopic.php?p=981#981</guid>
                                      </item>
                                      <item>
                                        <title>Assign Actionvalue Vector</title>
                                        <link>http://www.bluespec.com/forum/viewtopic.php?p=980#980</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='http://www.bluespec.com/forum/profile.php?mode=viewprofile&amp;u=166'&gt;quark&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Fri Apr 06, 2012 1:06 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      What exactly is it that you observe?  You only see one $display output?  Or you see 4 outputs but with the same value?&lt;br /&gt;
&lt;br /&gt;
What you have written is fine, and I see no reason why the simulation would not do what you intend.  I took your example and compiled it to Verilog and the output looks fine:&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;always@&amp;#40;negedge CLK&amp;#41;&lt;br /&gt;
begin&lt;br /&gt;
&amp;nbsp; #0;&lt;br /&gt;
&amp;nbsp; $display&amp;#40;&amp;quot;x value&amp;#58; %h&amp;quot;, v_multiplier$getResult&amp;#41;;&lt;br /&gt;
&amp;nbsp; $display&amp;#40;&amp;quot;x value&amp;#58; %h&amp;quot;, v_multiplier_1$getResult&amp;#41;;&lt;br /&gt;
&amp;nbsp; $display&amp;#40;&amp;quot;x value&amp;#58; %h&amp;quot;, v_multiplier_2$getResult&amp;#41;;&lt;br /&gt;
&amp;nbsp; $display&amp;#40;&amp;quot;x value&amp;#58; %h&amp;quot;, v_multiplier_3$getResult&amp;#41;;&lt;br /&gt;
end&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
However, this was a simple example with one clock and one reset.  Do you have multiple resets or clock gates?  If you're seeing only one $display, then maybe the other modules are in reset.  (BSC will warn you if there are multiple resets in one rule, so you would have seen a message during compilation.)&lt;br /&gt;
&lt;br /&gt;
If you're seeing four $display messages, but with the same value, then maybe the inputs to the modules were wrong?&lt;br /&gt;
&lt;br /&gt;
Anyway, what you've written looks fine, so I'd have to see more of the module to know if there's a bug in BSC.  If you can send the example to &lt;a href=&quot;mailto:support@bluespec.com&quot;&gt;support@bluespec.com&lt;/a&gt;, then we can have a look.</description>
                                        <comments>http://www.bluespec.com/forum/viewtopic.php?p=980#980</comments>
                                        <author>quark</author>
                                        <pubDate>Fri Apr 06, 2012 1:06 pm</pubDate>
                                        <guid isPermaLink="true">http://www.bluespec.com/forum/viewtopic.php?p=980#980</guid>
                                      </item>
                                      <item>
                                        <title>Logical partitioning of design/code (split rule precedence)</title>
                                        <link>http://www.bluespec.com/forum/viewtopic.php?p=978#978</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='http://www.bluespec.com/forum/profile.php?mode=viewprofile&amp;u=166'&gt;quark&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Wed Apr 04, 2012 8:07 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Ah, yes.  I don't believe that import-BVI supports concatenating or bit-extraction of ports, although this is something we are considering.  So, yes, you would need a wrapper to combine them into one struct.</description>
                                        <comments>http://www.bluespec.com/forum/viewtopic.php?p=978#978</comments>
                                        <author>quark</author>
                                        <pubDate>Wed Apr 04, 2012 8:07 pm</pubDate>
                                        <guid isPermaLink="true">http://www.bluespec.com/forum/viewtopic.php?p=978#978</guid>
                                      </item>
                                      <item>
                                        <title>BVI always_enabled &amp;amp; similar stuff (BVI doubts part 2)</title>
                                        <link>http://www.bluespec.com/forum/viewtopic.php?p=974#974</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='http://www.bluespec.com/forum/profile.php?mode=viewprofile&amp;u=928'&gt;rasha&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Mon Apr 02, 2012 11:30 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Thanks for the explanations quark!&lt;br /&gt;
Also: it seems to me that most of this&lt;br /&gt;
is not in any of the documents. &lt;img src=&quot;images/smiles/icon_wink.gif&quot; alt=&quot;Wink&quot; border=&quot;0&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
ranko</description>
                                        <comments>http://www.bluespec.com/forum/viewtopic.php?p=974#974</comments>
                                        <author>rasha</author>
                                        <pubDate>Mon Apr 02, 2012 11:30 am</pubDate>
                                        <guid isPermaLink="true">http://www.bluespec.com/forum/viewtopic.php?p=974#974</guid>
                                      </item>
                                      <item>
                                        <title>Clock gating in BVI wrappers (BVI doubts part.1)</title>
                                        <link>http://www.bluespec.com/forum/viewtopic.php?p=972#972</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='http://www.bluespec.com/forum/profile.php?mode=viewprofile&amp;u=166'&gt;quark&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Mon Apr 02, 2012 1:33 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      For #2, the import-BVI wrapper does not have a method like &amp;quot;clockRunning&amp;quot;.  The only place where &amp;quot;ce&amp;quot; is mentioned is in the ports for &amp;quot;clk_clk&amp;quot;, which are declared as &amp;quot;(clk,ce)&amp;quot;.  So, no, you're not driving &amp;quot;ce&amp;quot; to 1 in the wrapper.  But, yes, you would instantiate a mkGatedClock module in the BSV; and that module's interface has a method &amp;quot;setGateCond&amp;quot; as input to the module, and as output the module provides a clock with two ports (an oscillator and a gate).  So the mkGatedClock module is doing the work of converting a method call signal into a clock gate.  Then, if you instantiate the imported module with that generated clock, BSC will connect the generated output gate to the &amp;quot;ce&amp;quot; input automatically.&lt;br /&gt;
&lt;br /&gt;
This is assuming that &amp;quot;ce&amp;quot; is used as a clock gate inside the imported module.  If the &amp;quot;ce&amp;quot; signal really is a control signal that is only indirectly controlling the clocking, then you'll want to use option #1.</description>
                                        <comments>http://www.bluespec.com/forum/viewtopic.php?p=972#972</comments>
                                        <author>quark</author>
                                        <pubDate>Mon Apr 02, 2012 1:33 am</pubDate>
                                        <guid isPermaLink="true">http://www.bluespec.com/forum/viewtopic.php?p=972#972</guid>
                                      </item>
                                      <item>
                                        <title>SCE-MI2.0</title>
                                        <link>http://www.bluespec.com/forum/viewtopic.php?p=965#965</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='http://www.bluespec.com/forum/profile.php?mode=viewprofile&amp;u=1216'&gt;srinivasboppu&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Fri Mar 30, 2012 3:06 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Can we get  all these  things ( compiler, BlueSim and SCE_MI) license &lt;br /&gt;
as a  part of the university program ?&lt;br /&gt;
&lt;br /&gt;
We are from University of Erlangen-Nuremberg,   we would like to use it&lt;br /&gt;
in our research project.&lt;br /&gt;
&lt;br /&gt;
Regards,&lt;br /&gt;
Srinivas Boppu</description>
                                        <comments>http://www.bluespec.com/forum/viewtopic.php?p=965#965</comments>
                                        <author>srinivasboppu</author>
                                        <pubDate>Fri Mar 30, 2012 3:06 am</pubDate>
                                        <guid isPermaLink="true">http://www.bluespec.com/forum/viewtopic.php?p=965#965</guid>
                                      </item>
                                      <item>
                                        <title>New Release 2012.01.A is posted</title>
                                        <link>http://www.bluespec.com/forum/viewtopic.php?p=959#959</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='http://www.bluespec.com/forum/profile.php?mode=viewprofile&amp;u=5'&gt;kczeck&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Fri Feb 03, 2012 11:18 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      The latest Bluespec release 2012.01.A is available to registered users of the forum via Software Releases at &lt;a href=&quot;http://bluespec.com/forum/viewtopic.php?t=306.&quot; target=&quot;_blank&quot;&gt;http://bluespec.com/forum/viewtopic.php?t=306.&lt;/a&gt;  You must be logged in to the forum to see and download the files.</description>
                                        <comments>http://www.bluespec.com/forum/viewtopic.php?p=959#959</comments>
                                        <author>kczeck</author>
                                        <pubDate>Fri Feb 03, 2012 11:18 am</pubDate>
                                        <guid isPermaLink="true">http://www.bluespec.com/forum/viewtopic.php?p=959#959</guid>
                                      </item></channel></rss>
