summaryrefslogtreecommitdiff
path: root/rtl/cache/token.sv
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2024-01-21 06:23:46 -0600
committerAlejandro Soto <alejandro@34project.org>2024-02-20 11:11:17 -0600
commitf3b18ead59ae02f95dabbf0a1dea40873a816975 (patch)
tree8979e50f2a37f66a4cd27e937b480efe60d72cf7 /rtl/cache/token.sv
parenta8bc5a353ea997f73209b39377ee15a73e471237 (diff)
rtl: refactor filenames and directory hierarchy
Diffstat (limited to 'rtl/cache/token.sv')
-rw-r--r--rtl/cache/token.sv57
1 files changed, 0 insertions, 57 deletions
diff --git a/rtl/cache/token.sv b/rtl/cache/token.sv
deleted file mode 100644
index cb3e59d..0000000
--- a/rtl/cache/token.sv
+++ /dev/null
@@ -1,57 +0,0 @@
-`include "cache/defs.sv"
-
-module cache_token
-#(parameter TOKEN_AT_RESET=0)
-(
- input logic clk,
- rst_n,
-
- input addr_tag core_tag,
- input addr_index core_index,
-
- input ring_token in_token, // input del token
- input logic in_token_valid, // se está recibiendo el token
-
- output ring_token out_token, // output del token
- output logic out_token_valid, // se está enviando el token
-
- input logic send,
- lock_line,
- unlock_line,
- output logic locked,
- may_send
-);
-
- logic may_send_if_token_held;
-
- // Solo se puede iniciar un request si se tiene el token y el token es
- // válido
- assign may_send = may_send_if_token_held && in_token_valid;
- assign may_send_if_token_held
- = (!in_token.e2.valid || in_token.e2.index != core_index || in_token.e2.tag != core_tag)
- && (!in_token.e1.valid || in_token.e1.index != core_index || in_token.e1.tag != core_tag)
- && (!in_token.e0.valid || in_token.e0.index != core_index || in_token.e0.tag != core_tag);
-
- always_ff @(posedge clk or negedge rst_n)
- if (!rst_n) begin
- out_token <= {($bits(out_token)){1'b0}};
- out_token_valid <= TOKEN_AT_RESET;
-
- locked <= 0;
- end else begin
- out_token.e0.tag <= core_tag;
- out_token.e0.index <= core_index;
- out_token.e0.valid <= may_send_if_token_held && (send || locked) && !unlock_line;
-
- out_token.e2 <= in_token.e1;
- out_token.e1 <= in_token.e0;
- out_token_valid <= in_token_valid;
-
- if (lock_line)
- locked <= 1;
-
- if (unlock_line)
- locked <= 0;
- end
-
-endmodule