[Cryptech-Commits] [core/platform/alpha] 02/02: Byte-swap in hardware, so we can do memcpy from software.

git at cryptech.is git at cryptech.is
Mon Apr 8 19:30:35 UTC 2019


This is an automated email from the git hooks/post-receive script.

paul at psgd.org pushed a commit to branch master
in repository core/platform/alpha.

commit ab23f87e78f441830587c6c82d90e35b4cec7d29
Author: Paul Selkirk <paul at psgd.org>
AuthorDate: Fri Apr 5 17:50:17 2019 -0400

    Byte-swap in hardware, so we can do memcpy from software.
---
 rtl/alpha_fmc_top.v | 18 ++++++++++++++++--
 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"
 
 
 



More information about the Commits mailing list