Writing a verilog code for a crossbar switch

Status
Not open for further replies.

prasan61

Newbie level 2
Joined
Nov 6, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,295
Hi,I need a verilog code for a banyan switch...
if there are two inputs say x1 and x2
and two outputs say y1 and y2
there is a select line s
for s=0 i must send the data through upper port
for s=1 i must send data through lower port.
 

Hi,I need a verilog code for a banyan switch...
if there are two inputs say x1 and x2
and two outputs say y1 and y2
there is a select line s
for s=0 i must send the data through upper port
for s=1 i must send data through lower port.

can you give detail..i mean what is your input data? is it {x1,x2} ?
 

Re: Writing a verilog code for switches

i need to write verilog code for banyan network, omega network, cube network and indirect binary n-cube network...that is multistage interconnection networks.
can anyone help me.
where can i find tips for writing the codes...from where i should start with the codes...is there any website for reference...
 

Hi,I need a verilog code for a banyan switch...
if there are two inputs say x1 and x2
and two outputs say y1 and y2
there is a select line s
for s=0 i must send the data through upper port
for s=1 i must send data through lower port.




Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
10
module crbar(y1,y2,x1,x2,s);
output y1,y2;[/CODE]
input x1,x2;
input s;
 
assign y1=((~s&x1)|(s&x2));
 
assign y2=((~s&x2)|(s&x1));
 
endmodule

 
Last edited:


Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
10
module crbar(y1,y2,x1,x2,s);
output y1,y2;[/CODE]
input x1,x2;
input s;
 
assign y1=((~s&x1)|(s&x2));
 
assign y2=((~s&x2)|(s&x1));
 
endmodule


This code doesn't describe a banyan switch. As a reference: https://en.wikipedia.org/wiki/Banyan_switch
As described the selection is based on a signal in the input port, so there should have been an s1 and s2. The assignments would therefore be:

Code:
assign y1 = ~s1 & x1 | ~s2 & x2;
assign y2 = s1 & x1 | s2  & x2;

It's similar to a crossbar switch or a crossover switch.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…