diff options
author | Paul Selkirk <paul@psgd.org> | 2015-11-23 17:54:12 -0500 |
---|---|---|
committer | Paul Selkirk <paul@psgd.org> | 2015-11-23 17:54:12 -0500 |
commit | 84a13e7563588104a10946363c7e04ad9bec2ede (patch) | |
tree | afa37f8f8add1c3daca7d841a5855f26266eac15 /eim/rtl | |
parent | a4737cc9305cbab9bb9c044fad48d75dff37568c (diff) |
If we really must byte-swap, try doing it in hardware, to make it easier to do memcpy from software.hardware_htonl
Diffstat (limited to 'eim/rtl')
-rw-r--r-- | eim/rtl/novena_eim.v | 19 |
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), |