FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal


Go Back   FPGA Groups > NewsGroup > Verilog

Verilog comp.lang.verilog newsgroup / usenet

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-27-2009, 02:49 AM
Posts: n/a
Default System Verilog:-streaming operator

Guys,Any idea on what is streaming operator?And how is it diffferent
from static casting operator?
Reply With Quote
  #2 (permalink)  
Old 03-06-2009, 05:27 PM
Jonathan Bromley
Posts: n/a
Default Re: System Verilog:-streaming operator

On Thu, 26 Feb 2009 17:49:56 -0800 (PST), varsha wrote:

>Guys,Any idea on what is streaming operator?
>And how is it diffferent from static casting operator?

Do you mean the streaming concatenation operator {<<{}}
in SystemVerilog? This operator does several rather
unusual things:
- it allows you to assemble a stream of bits, of
arbitrarty length, from almost any collection of
expressions - including unpacked arrays and
structs, and the contents of class objects;
- then, if you use << right-to-left streaming, it
reverses that stream of bits - but it does so
in "chunks" or blocks of a size you specify;
- finally, the resulting stream of bits can be
copied into any reasonable target variable -
for example, an unpacked array, a queue, ...
and the ordering of the bits in that copy is
- and, as a final trick, it can appear as the
TARGET of an assignment, in which case it
does the reverse operation, unpacking a stream
of bits into a collection of variables.

A few simple examples:

// in these variable-names, each letter
// stands for one bit
bit a,b,c,d;
bit [3:0] efgh;
bit [7:0] pqrstuvw;

// another variable:
bit [7:0] x;

// example 1: assemble a bunch of bits
// using left-to-right streaming
x = {>>{a,b,c,d,efgh}};
// yields x = abcdefgh

// example 2: reverse a vector using right-to-left
// streaming with the default block size of 1 bit
x = {<<{pqrstuvw}};
// yields x = wvutsrqp

// example 3: reverse a vector using right-to-left
// streaming with block size = 4
x = {<<4{pqrstuvw}};
// yields x = tuvwpqrs

// example 4: unpack (streaming concatenation as target)
{>>{a,b,c,d,efgh}} = pqrstuvw;
// yields a=p, b=q, c=r, d=s, efgh=tuvw

I don't know the current state of synthesis support for
this construct; all the examples I gave above *should*
be synthesisable, but I haven't tried it in real tools.

Hope this helps
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
[email protected]

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Audio pops in live audio streaming system. DSP 10 12-26-2007 07:02 PM
Verilog ternary operator Sailu Verilog 2 09-08-2007 01:02 AM
Verilog operator bir Verilog 1 04-10-2007 08:39 PM
question about interchanging limit and operator in system theory kiki DSP 4 08-19-2005 12:18 PM
Re: Operator Overloading in Verilog Ajeetha Kumari Verilog 0 06-28-2003 06:39 PM

All times are GMT +1. The time now is 06:19 AM.

Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved