mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-03-12 10:06:47 -04:00
fpga: Add extra access control on UDS
Restrict access to UDS when we have exited firmware the first time. Co-authored-by: Michael Cardell Widerkrantz <mc@tillitis.se>
This commit is contained in:
parent
77fc5cf578
commit
7554787678
@ -21,6 +21,7 @@ module tk1 #(
|
||||
|
||||
input wire cpu_trap,
|
||||
output wire app_mode,
|
||||
output wire fw_startup_done,
|
||||
|
||||
input wire [31 : 0] cpu_addr,
|
||||
input wire cpu_instr,
|
||||
@ -180,20 +181,21 @@ module tk1 #(
|
||||
//----------------------------------------------------------------
|
||||
// Concurrent connectivity for ports etc.
|
||||
//----------------------------------------------------------------
|
||||
assign read_data = tmp_read_data;
|
||||
assign ready = tmp_ready;
|
||||
assign read_data = tmp_read_data;
|
||||
assign ready = tmp_ready;
|
||||
|
||||
assign app_mode = fw_startup_done_reg & ~syscall;
|
||||
assign app_mode = fw_startup_done_reg & ~syscall;
|
||||
assign fw_startup_done = fw_startup_done_reg;
|
||||
|
||||
assign force_trap = force_trap_reg;
|
||||
assign force_trap = force_trap_reg;
|
||||
|
||||
assign gpio3 = gpio3_reg;
|
||||
assign gpio4 = gpio4_reg;
|
||||
assign gpio3 = gpio3_reg;
|
||||
assign gpio4 = gpio4_reg;
|
||||
|
||||
assign ram_addr_rand = ram_addr_rand_reg;
|
||||
assign ram_data_rand = ram_data_rand_reg;
|
||||
assign ram_addr_rand = ram_addr_rand_reg;
|
||||
assign ram_data_rand = ram_data_rand_reg;
|
||||
|
||||
assign system_reset = system_reset_reg;
|
||||
assign system_reset = system_reset_reg;
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// Module instance.
|
||||
|
@ -17,8 +17,7 @@ module uds (
|
||||
input wire clk,
|
||||
input wire reset_n,
|
||||
|
||||
input wire app_mode,
|
||||
|
||||
input wire en,
|
||||
input wire cs,
|
||||
input wire [ 2 : 0] address,
|
||||
output wire [31 : 0] read_data,
|
||||
@ -89,7 +88,7 @@ module uds (
|
||||
if (cs) begin
|
||||
tmp_ready = 1'h1;
|
||||
|
||||
if (!app_mode) begin
|
||||
if (en) begin
|
||||
if (uds_rd_reg[address[2 : 0]] == 1'h0) begin
|
||||
uds_rd_we = 1'h1;
|
||||
end
|
||||
|
@ -154,6 +154,7 @@ module application_fpga (
|
||||
wire [31 : 0] tk1_read_data;
|
||||
wire tk1_ready;
|
||||
wire app_mode;
|
||||
wire fw_startup_done;
|
||||
wire force_trap;
|
||||
wire [14 : 0] ram_addr_rand;
|
||||
wire [31 : 0] ram_data_rand;
|
||||
@ -294,7 +295,7 @@ module application_fpga (
|
||||
.clk(clk),
|
||||
.reset_n(reset_n),
|
||||
|
||||
.app_mode(app_mode),
|
||||
.en(~fw_startup_done),
|
||||
|
||||
.cs(uds_cs),
|
||||
.address(uds_address),
|
||||
@ -341,6 +342,7 @@ module application_fpga (
|
||||
.reset_n(reset_n),
|
||||
|
||||
.app_mode(app_mode),
|
||||
.fw_startup_done(fw_startup_done),
|
||||
|
||||
.cpu_addr (cpu_addr),
|
||||
.cpu_instr (cpu_instr),
|
||||
|
@ -166,6 +166,7 @@ module application_fpga_sim (
|
||||
wire [31 : 0] tk1_read_data;
|
||||
wire tk1_ready;
|
||||
wire app_mode;
|
||||
wire fw_startup_done;
|
||||
wire force_trap;
|
||||
wire [14 : 0] ram_addr_rand;
|
||||
wire [31 : 0] ram_data_rand;
|
||||
@ -305,7 +306,7 @@ module application_fpga_sim (
|
||||
.clk(clk),
|
||||
.reset_n(reset_n),
|
||||
|
||||
.app_mode(app_mode),
|
||||
.en(~fw_startup_done),
|
||||
|
||||
.cs(uds_cs),
|
||||
.address(uds_address),
|
||||
@ -354,6 +355,7 @@ module application_fpga_sim (
|
||||
.reset_n(reset_n),
|
||||
|
||||
.app_mode(app_mode),
|
||||
.fw_startup_done(fw_startup_done),
|
||||
|
||||
.cpu_addr (cpu_addr),
|
||||
.cpu_instr (cpu_instr),
|
||||
|
Loading…
x
Reference in New Issue
Block a user