Bluespec SystemVerilog

1 program Added 2025-10-28T16:03:46Z Model: google/gemini-2.5-proTemp: 0.4 Evidence Report issue View issues
Aliases: BSV
Provenance: commit 00906e86e1 · authored 2025-10-28T17:03:46+01:00 · model google/gemini-2.5-pro

Sources mentioning this language

1 source · not in taxonomy (canonical name didn't match any upstream)
LLM (this repo) · 1

Related languages

BSV (0.90)Bluespec (0.64)SystemVerilog (0.43)SystemC (0.16)Verilog-A (0.15)

LLM-contributed programs

A Parallel FIFO Buffer in BSV

Provenance: commit 00906e86e1 · authored 2025-10-28T17:03:46+01:00 · model google/gemini-2.5-pro · Temp 0.4
code.bsv · license: Bluespec Public License · added: 2025-10-28T16:03:46Z
/* Copyright 2005-2008, Bluespec, Inc.  All rights reserved. */

package Fifo;

/*
 * This FIFO has the standard FIFO interface.
 *
 * The implementation uses a vector of registers and two pointers
 * to identify the valid region of the vector.
 *
 * This implementation is fully parallel.  It can enq and deq in the
 * same cycle when not empty and not full.
 */

import Vector::*;
import FIFO::*;

// A convenient type for FIFO sizes
typedef 4 Size;
typedef TLog#(Size) Ptr;

// An interface with one method, to read the current count
interface FifoCount;
   method ActionValue#(Bit#(Ptr)) count();
endinterface

// The FIFO module
// It has a FIFO interface and a FifoCount interface
// The FIFO interface is parameterized by the type of data in the FIFO
module mkFifo(FIFO#(Bit#(32)));

   // The state
   Reg#(Bit#(32))     data [valueof(Size)];
   Reg#(Bit#(Ptr))    head <- mkReg(0);
   Reg#(Bit#(Ptr))    tail <- mkReg(0);
   Reg#(Bool)         full <- mkReg(False);

   // The interface methods
   interface FIFO fifo;
      method Action enq(Bit#(32) x);
         data[tail] <= x;
         tail <= tail + 1;
         if (head == tail + 1)
            full <= True;
      endmethod

      method Action deq();
         head <= head + 1;
         full <= False;
      endmethod

      method Bit#(32) first();
         return data[head];
      endmethod

      method notFull = !full;

      method notEmpty = (head != tail) || full;
   endinterface

   // The second interface
   interface FifoCount fcount;
      method ActionValue#(Bit#(Ptr)) count();
         let d = tail - head;
         if (full)
            return fromInteger(valueof(Size));
         else
            return d;
      endmethod
   endinterface

endmodule

endpackage

Contribute — propose a file extension

Tell us where to find evidence about Bluespec SystemVerilog (mapped to pl/bluespec_systemverilog). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/Bluespec SystemVerilog/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← Bluespec BH Blur →