diff options
author | Paul Selkirk <paul@psgd.org> | 2019-04-05 17:50:17 -0400 |
---|---|---|
committer | Paul Selkirk <paul@psgd.org> | 2019-04-05 17:50:17 -0400 |
commit | ab23f87e78f441830587c6c82d90e35b4cec7d29 (patch) | |
tree | 53c1b4b80b64447d78130795578346f993a7d9e9 /rtl | |
parent | 6439bac28538138cb2c49691d5485dd16ab6fa96 (diff) |
Byte-swap in hardware, so we can do memcpy from software.
Diffstat (limited to 'rtl')
-rw-r--r-- | rtl/alpha_fmc_top.v | 18 | ||||
-rw-r--r-- | rtl/alpha_regs.v | 2 |
2 files changed, 17 insertions, 3 deletions
diff --git a/rtl/alpha_fmc_top.v b/rtl/alpha_fmc_top.v index 1bc1ce2..a07beee 100644 --- a/rtl/alpha_fmc_top.v +++ b/rtl/alpha_fmc_top.v @@ -140,6 +140,20 @@ module alpha_fmc_top // hashes, RNGs and ciphers to different regions (segments) of memory. //---------------------------------------------------------------- + // A note on byte-swapping: + // STM32 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] write_data; + assign write_data = {sys_fmc_dout[7:0], sys_fmc_dout[15:8], sys_fmc_dout[23:16], sys_fmc_dout[31:24]}; + + wire [31 : 0] read_data; + assign sys_fmc_din = {read_data[7:0], read_data[15:8], read_data[23:16], read_data[31:24]}; + core_selector cores ( .sys_clk(sys_clk), @@ -148,8 +162,8 @@ module alpha_fmc_top .sys_fmc_addr(sys_fmc_addr), .sys_fmc_wr(sys_fmc_wren), .sys_fmc_rd(sys_fmc_rden), - .sys_write_data(sys_fmc_dout), - .sys_read_data(sys_fmc_din), + .sys_write_data(write_data), + .sys_read_data(read_data), .noise(ct_noise), diff --git a/rtl/alpha_regs.v b/rtl/alpha_regs.v index a53d2d3..ce17863 100644 --- a/rtl/alpha_regs.v +++ b/rtl/alpha_regs.v @@ -68,7 +68,7 @@ module board_regs // Core ID constants. localparam CORE_NAME0 = 32'h414c5048; // "ALPH" localparam CORE_NAME1 = 32'h41202020; // "A " - localparam CORE_VERSION = 32'h302e3130; // "0.10" + localparam CORE_VERSION = 32'h302e3230; // "0.20" |