mirror of
https://github.com/aolofsson/oh.git
synced 2025-01-30 02:32:53 +08:00
Adding emesh to packet converters
-getting tired of all the typing after all....
This commit is contained in:
parent
cc5f165454
commit
2b22d1c4af
52
common/hdl/emesh2packet.v
Normal file
52
common/hdl/emesh2packet.v
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/*Converts an emesh bundle into a 104 bit packet*/
|
||||||
|
module emesh2packet(/*AUTOARG*/
|
||||||
|
// Outputs
|
||||||
|
packet_out,
|
||||||
|
// Inputs
|
||||||
|
access_in, write_in, datamode_in, ctrlmode_in, dstaddr_in, data_in,
|
||||||
|
srcaddr_in
|
||||||
|
);
|
||||||
|
|
||||||
|
parameter AW=32;
|
||||||
|
parameter DW=32;
|
||||||
|
parameter PW=104;
|
||||||
|
|
||||||
|
//Emesh signal bundle
|
||||||
|
input access_in;
|
||||||
|
input write_in;
|
||||||
|
input [1:0] datamode_in;
|
||||||
|
input [3:0] ctrlmode_in;
|
||||||
|
input [AW-1:0] dstaddr_in;
|
||||||
|
input [DW-1:0] data_in;
|
||||||
|
input [AW-1:0] srcaddr_in;
|
||||||
|
|
||||||
|
//Output packet
|
||||||
|
output [PW-1:0] packet_out;
|
||||||
|
|
||||||
|
assign packet_out[0] = access_in;
|
||||||
|
assign packet_out[1] = write_in;
|
||||||
|
assign packet_out[3:2] = datamode_in[1:0];
|
||||||
|
assign packet_out[7:4] = ctrlmode_in[7:4];
|
||||||
|
assign packet_out[39:8] = dstaddr_in[AW-1:0];
|
||||||
|
assign packet_out[71:40] = data_in[AW-1:0];
|
||||||
|
assign packet_out[103:72] = srcaddr_in[AW-1:0];
|
||||||
|
|
||||||
|
endmodule // emesh2packet
|
||||||
|
/*
|
||||||
|
Copyright (C) 2015 Adapteva, Inc.
|
||||||
|
Contributed by Andreas Olofsson <support@adapteva.com>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program (see the file COPYING). If not, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
52
common/hdl/packet2emesh.v
Normal file
52
common/hdl/packet2emesh.v
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/*Converts an emesh bundle into a 104 bit packet*/
|
||||||
|
module packet2emesh(/*AUTOARG*/
|
||||||
|
// Outputs
|
||||||
|
access_out, write_out, datamode_out, ctrlmode_out, dstaddr_out,
|
||||||
|
data_out, srcaddr_out,
|
||||||
|
// Inputs
|
||||||
|
packet_in
|
||||||
|
);
|
||||||
|
|
||||||
|
parameter AW=32;
|
||||||
|
parameter DW=32;
|
||||||
|
parameter PW=104;
|
||||||
|
|
||||||
|
//Emesh signal bundle
|
||||||
|
output access_out;
|
||||||
|
output write_out;
|
||||||
|
output [1:0] datamode_out;
|
||||||
|
output [3:0] ctrlmode_out;
|
||||||
|
output [AW-1:0] dstaddr_out;
|
||||||
|
output [DW-1:0] data_out;
|
||||||
|
output [AW-1:0] srcaddr_out;
|
||||||
|
|
||||||
|
//Output packet
|
||||||
|
input [PW-1:0] packet_in;
|
||||||
|
|
||||||
|
assign access_out = packet_in[0];
|
||||||
|
assign write_out = packet_in[1];
|
||||||
|
assign datamode_out[1:0] = packet_in[3:2];
|
||||||
|
assign ctrlmode_out[3:0] = packet_in[7:4];
|
||||||
|
assign dstaddr_out[AW-1:0] = packet_in[39:8];
|
||||||
|
assign data_out[AW-1:0] = packet_in[71:40];
|
||||||
|
assign srcaddr_out[AW-1:0] = packet_in[103:72];
|
||||||
|
|
||||||
|
endmodule // emesh2packet
|
||||||
|
/*
|
||||||
|
Copyright (C) 2015 Adapteva, Inc.
|
||||||
|
Contributed by Andreas Olofsson <support@adapteva.com>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program (see the file COPYING). If not, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
Loading…
x
Reference in New Issue
Block a user