aboutsummaryrefslogtreecommitdiff
path: root/eim/rtl/novena_eim.v
diff options
context:
space:
mode:
Diffstat (limited to 'eim/rtl/novena_eim.v')
-rw-r--r--eim/rtl/novena_eim.v19
1 files changed, 15 insertions, 4 deletions
diff --git a/eim/rtl/novena_eim.v b/eim/rtl/novena_eim.v
index 8feec20..b9db09f 100644
--- a/eim/rtl/novena_eim.v
+++ b/eim/rtl/novena_eim.v
@@ -143,12 +143,23 @@ module novena_top
//----------------------------------------------------------------
// Core Selector
//
- // This multiplexer is used to map different types of cores, such as
- // hashes, RNGs and ciphers to different regions (segments) of memory.
+ // This multiplexer maps read and write requests to the appropriate
+ // core.
//----------------------------------------------------------------
+ // A note on byte-swapping:
+ // i.MX6 is little-endian, while the register interface here is
+ // big-endian. The software reads and writes 32-bit integer values,
+ // which means transmitting the least significant byte first. Up to
+ // now, we've been doing byte-swapping in software, which is
+ // inefficient, especially for bulk data transfer. So now we're doing
+ // the byte-swapping in hardware.
+
+ wire [31:0] tmp_write_data;
+ assign tmp_write_data = {sys_eim_dout[7:0], sys_eim_dout[15:8], sys_eim_dout[23:16], sys_eim_dout[31:24]};
+
wire [31 : 0] tmp_read_data;
- assign sys_eim_din = tmp_read_data;
+ assign sys_eim_din = {tmp_read_data[7:0], tmp_read_data[15:8], tmp_read_data[23:16], tmp_read_data[31:24]};
core_selector cores
(
@@ -158,7 +169,7 @@ module novena_top
.sys_eim_addr(sys_eim_addr),
.sys_eim_wr(sys_eim_wr),
.sys_eim_rd(sys_eim_rd),
- .sys_write_data(sys_eim_dout),
+ .sys_write_data(tmp_write_data),
.sys_read_data(tmp_read_data),
.noise(ct_noise),