From d788e0da2de6257f2dbb1f6f6afd65a144480166 Mon Sep 17 00:00:00 2001 From: Andreas Olofsson Date: Wed, 11 Nov 2015 13:59:24 -0500 Subject: [PATCH] Fixing alignment issue on write -The epiphany chip memory does alignment on write --- emesh/dv/ememory.v | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/emesh/dv/ememory.v b/emesh/dv/ememory.v index 2a491f0..d8f30df 100644 --- a/emesh/dv/ememory.v +++ b/emesh/dv/ememory.v @@ -52,12 +52,13 @@ module ememory(/*AUTOARG*/ wire [AW-1:0] dstaddr_in; wire [DW-1:0] data_in; wire [AW-1:0] srcaddr_in; - + wire [DW-1:0] data_align; + packet2emesh #(.PW(PW)) p2e ( .write_out (write_in), - .datamode_out (datamode_in[1:0]), + .datamode_out (datamode_in[1:0] ), .ctrlmode_out (ctrlmode_in[3:0]), .dstaddr_out (dstaddr_in[AW-1:0]), .data_out (data_in[DW-1:0]), @@ -77,9 +78,14 @@ module ememory(/*AUTOARG*/ //Address-in (shifted by three bits, 64 bit wide memory) assign addr[MAW-1:0] = dstaddr_in[MAW+2:3]; + //Shift up + assign data_align[DW-1:0] = (datamode_in[1:0]==2'b00) ? {(4){data_in[7:0]}} : + (datamode_in[1:0]==2'b01) ? {(2){data_in[15:0]}} : + data_in[31:0]; + //Data-in (hardoded width) - assign din[63:0] =(datamode_in[1:0]==2'b11) ? {srcaddr_in[31:0],data_in[31:0]}: - {data_in[31:0],data_in[31:0]}; + assign din[63:0] =(datamode_in[1:0]==2'b11) ? {srcaddr_in[31:0],data_align[31:0]}: + {data_align[31:0],data_align[31:0]}; //Write mask always@* casez({write_in, datamode_in[1:0],dstaddr_in[2:0]}) @@ -163,12 +169,12 @@ module ememory(/*AUTOARG*/ ) emesh_monitor (.dut_access (access_in & write_in), .dut_packet (packet_in[PW-1:0]), - .wait_in (1'b0), + .wait_in (1'b0), /*AUTOINST*/ // Inputs - .clk (clk), - .nreset (nreset), - .coreid (coreid[IDW-1:0])); + .clk (clk), + .nreset (nreset), + .coreid (coreid[IDW-1:0])); endmodule // emesh_memory // Local Variables: