Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- always @(posedge clk)
- begin
- function dijkstra;
- input [0:49] par;
- input [0:49] dist;
- input [0:49] visited = 0;
- input [0:49] g;
- input [0:9] k=0;
- input [0:9] v=0;
- dist[src] = 0;
- par[src] = 1;
- begin
- for (k=0; k<n-1; k=k+1)
- assign u = getMin(dist,visited);
- for (v=0; v<n; v=v+1)
- if(!visited[v] && (dist[u] + cost[u][v] < dist[v] && cost[u][v]! = 999 )
- begin
- par[v] = u;
- dist[v] = dist[u] + cost[u][v];
- end
- end
- end
- end
- end
- end
- endfunction
- par[src] = -1;
- for(g=0; g<n-1; g=g+1)
- if(!visited[v] && (dist[u] + cost[u][v] < dist[v] && cost[u][v]! = 999 )
- begin
- par[v] = u;
- dist[v] = dist[u] + cost[u][v];
- end
- end
- end
- end
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement