Skip to content

Commit

Permalink
(fpga) Extend RAM address to 16 bits.
Browse files Browse the repository at this point in the history
       In order to do correct scrambling the address to the RAM core
       must be 16 bits, not 15.

Signed-off-by: Joachim Strömbergson <[email protected]>
  • Loading branch information
secworks committed Aug 22, 2024
1 parent 404a1e0 commit 441e790
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions hw/application_fpga/core/ram/rtl/ram.v
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module ram(

input wire cs,
input wire [03 : 0] we,
input wire [14 : 0] address,
input wire [15 : 0] address,
input wire [31 : 0] write_data,
output wire [31 : 0] read_data,
output wire ready
Expand Down Expand Up @@ -140,7 +140,7 @@ module ram(
//----------------------------------------------------------------
always @*
begin: scramble_descramble
scrambled_ram_addr = address ^ ram_addr_rand;
scrambled_ram_addr = address[14 : 0] ^ ram_addr_rand;
scrambled_write_data = write_data ^ ram_data_rand ^ {2{address}};
descrambled_read_data = muxed_read_data ^ ram_data_rand ^ {2{address}};
end
Expand Down
4 changes: 2 additions & 2 deletions hw/application_fpga/rtl/application_fpga.v
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ module application_fpga(

reg ram_cs;
reg [3 : 0] ram_we;
reg [14 : 0] ram_address;
reg [15 : 0] ram_address;
reg [31 : 0] ram_write_data;
wire [31 : 0] ram_read_data;
wire ram_ready;
Expand Down Expand Up @@ -397,7 +397,7 @@ module application_fpga(

ram_cs = 1'h0;
ram_we = 4'h0;
ram_address = cpu_addr[16 : 2];
ram_address = cpu_addr[17 : 2];
ram_write_data = cpu_wdata;

fw_ram_cs = 1'h0;
Expand Down

0 comments on commit 441e790

Please sign in to comment.