xy routing algorithm verilog
#1
Tongue 

Hi i am venkat i would like to get details on xy routing algorithm verilog
Reply
#2
following Verilog code for xy routing algorithm, I do not understand the use of parameter PORT_NUM. Also, for how many ports is this code designed? 2X2 or 4X4? Please explain the code to me.

`define LOG2 function integer log2;\
input integer number; begin \
log2=0; \
while(2**log2<number) begin \
log2=log2+1; \
end \
end \
endfunction // log2


module look_ahead_xy #(
parameter PORT_NUM = 5,
parameter X_NODE_NUM = 4,
parameter Y_NODE_NUM = 4,
parameter SW_X_ADDR = 2,
parameter SW_Y_ADDR = 1,
parameter PORT_NUM_BCD_WIDTH = log2(PORT_NUM),
parameter X_NODE_NUM_WIDTH = log2(X_NODE_NUM),
parameter Y_NODE_NUM_WIDTH = log2(Y_NODE_NUM)
)
(
input [X_NODE_NUM_WIDTH-1 :0] dest_x_node_in,
input [Y_NODE_NUM_WIDTH-1 :0] dest_y_node_in,
output [PORT_NUM_BCD_WIDTH-1 :0] port_num_out// one extra bit will be removed by cross bar switch later
);

`LOG2

/*
localparam LOCAL = 5'b00001;
localparam EAST = 5'b00010;
localparam NORTH = 5'b00100;
localparam WEST = 5'b01000;
localparam SOUTH = 5'b10000;
*/

localparam LOCAL = 3'd0;
localparam EAST = 3'd1;
localparam NORTH = 3'd2;
localparam WEST = 3'd3;
localparam SOUTH = 3'd4;


reg [PORT_NUM_BCD_WIDTH-1 :0] port_num_next;


wire signed [X_NODE_NUM_WIDTH :0] xc;//current
wire signed [X_NODE_NUM_WIDTH :0] xd;//destination
wire signed [Y_NODE_NUM_WIDTH :0] yc;//current
wire signed [Y_NODE_NUM_WIDTH :0] yd;//destination
wire signed [X_NODE_NUM_WIDTH :0] xdiff;
wire signed [Y_NODE_NUM_WIDTH :0] ydiff;


assign xc ={1'b0, SW_X_ADDR [X_NODE_NUM_WIDTH-1 :0]};
assign yc ={1'b0, SW_Y_ADDR [Y_NODE_NUM_WIDTH-1 :0]};
assign xd ={1'b0, dest_x_node_in};
assign yd ={1'b0, dest_y_node_in};
assign xdiff = xd-xc;
assign ydiff = yd-yc;
assign port_num_out= port_num_next;

always@(*)begin
port_num_next = LOCAL;
if (xdiff > 1) port_num_next = EAST;
else if (xdiff < -1) port_num_next = WEST;
else if (xdiff == 1 || xdiff == -1 )begin
if (ydiff >= 1) port_num_next = SOUTH;
else if (ydiff == 0) port_num_next = LOCAL;
else port_num_next = NORTH;
end// xdiff == 1 || xdiff == -1
else begin //xdiff ==0
if (ydiff > 1) port_num_next = SOUTH;
else if (ydiff == 1) port_num_next = LOCAL;
else if (ydiff ==-1) port_num_next = LOCAL;
else if (ydiff < -1) port_num_next = NORTH;
else port_num_next = {PORT_NUM_BCD_WIDTH{1'bx}}; //xdiff ==0
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: routing algorithm verilog, xy routing algorithm verilog,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  can anyone provide us verilog HDL code for DWT 0 6,392 28-11-2018, 11:21 AM
Last Post:
  algorithm of railway reservation system 0 667 02-10-2018, 10:50 PM
Last Post: Guest
  verilog code for atm machine pdf 1 705 27-07-2018, 10:38 AM
Last Post: Guest
  md5 algorithm advantages and disadvantages 0 594 18-07-2018, 02:52 PM
Last Post: Guest
Thumbs Up online detection and prevention of phishing attacks using linkguard algorithm 1 670 12-07-2018, 02:30 PM
Last Post: BhavyaJyothi
  vending machine full project in verilog 0 619 02-07-2018, 10:15 PM
Last Post: Guest
  verilog code for linear convolution 0 527 19-06-2018, 05:26 PM
Last Post: Guest
  verilog code for 8 bit nikhilam sutra 0 530 15-06-2018, 11:44 AM
Last Post: Guest
  pegasis algorithm code in matlab 1 592 29-05-2018, 10:53 PM
Last Post: Guest
  source code of bellman ford algorithm in opengl 0 652 24-05-2018, 12:47 AM
Last Post: Guest

Forum Jump: