1
0
mirror of https://github.com/aolofsson/oh.git synced 2025-01-30 02:32:53 +08:00
oh/emesh/hdl/emesh2packet.v
Andreas Olofsson fd7aff5dd8 Fixing warning messages in chip synthesis tool
- Don't fight the tools
- No way to remove these warnings and I don't want to have to tell everyone to include maging "don't output this kind of warning flags" that are global to a project...that's just bad practice.
- Didn't take many minutes to remove these warnings and now synthesis runs through with 0 warnings ... much cleaner.. inspires more confidence
2016-02-12 11:04:52 -05:00

67 lines
1.7 KiB
Verilog

/*
* ---- 32-BIT ADDRESS ----
* [1] write bit
* [2:1] datamode
* [6:3] ctrlmode
* [7] RESERVED
* [39:8] f0 = dstaddr(lo)
* [71:40] f1 = data (lo)
* [103:72] f2 = srcaddr(lo) / data (hi)
*
* ---- 64-BIT ADDRESS ----
* [0] write bit
* [2:1] datamode
* [7:3] ctrlmode
* [39:8] f0 = dstaddr(lo)
* [71:40] f1 = D0
* [103:72] f2 = D1 | srcaddr(lo)
* [135:104] f3 = D2 | srcaddr(hi)
* [167:136] f4 = D3 | dstaddr(hi)
*
*/
module emesh2packet(/*AUTOARG*/
// Outputs
packet_out,
// Inputs
write_out, datamode_out, ctrlmode_out, dstaddr_out, data_out,
srcaddr_out
);
parameter AW = 32;
parameter PW = 2*AW+40;
//Emesh signal bundle
input write_out;
input [1:0] datamode_out;
input [4:0] ctrlmode_out;
input [AW-1:0] dstaddr_out;
input [AW-1:0] data_out;
input [AW-1:0] srcaddr_out;
//Output packet
output [PW-1:0] packet_out;
assign packet_out[0] = write_out;
assign packet_out[2:1] = datamode_out[1:0];
assign packet_out[7:3] = ctrlmode_out[4:0];
generate
if(AW==64)
begin : packet64
assign packet_out[39:8] = dstaddr_out[AW/2-1:0];
assign packet_out[71:40] = data_out[AW/2-1:0];
assign packet_out[103:72] = srcaddr_out[AW/2-1:0];
assign packet_out[135:104] = srcaddr_out[AW-1:AW/2];
assign packet_out[167:136] = dstaddr_out[AW-1:AW/2];
end
else
begin : packet32
assign packet_out[39:8] = dstaddr_out[AW-1:0];
assign packet_out[71:40] = data_out[AW-1:0];
assign packet_out[103:72] = srcaddr_out[AW-1:0];
end
endgenerate
endmodule // emesh2packet