-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
178 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// By Hugo BABIN-RIBY for CVA6 2023 hackathon | ||
// Desc : cvxif non-addressed registers | ||
|
||
module cvxif_registers #( | ||
parameter Nb_of_regs = 150, | ||
parameter signed_regs = 0, | ||
parameter reg_width = 9 | ||
) ( | ||
// CVA6 base signals | ||
input logic clk_i, | ||
input logic rst_ni, | ||
// Dump signal, equivalent to reset, set all to 0 | ||
input logic dump_i, | ||
// WriteEnable signal | ||
input logic we_i, | ||
// actual data to load | ||
input logic [reg_width-1:0] wb_data_i, | ||
// register memory | ||
output logic [Nb_of_regs-1:0][reg_width-1:0] regs_q | ||
); | ||
|
||
logic [reg_width-1:0] wb_pointer_q; // todo : fix this, supposed to be log_2(150) | ||
|
||
// overflowing ? | ||
logic overflow; | ||
assign overflow = (wb_pointer_q >= Nb_of_regs); | ||
|
||
if(signed_regs) begin | ||
logic signed [Nb_of_regs-1:0][reg_width-1:0] regs_q; | ||
end else begin | ||
logic unsigned [Nb_of_regs-1:0][reg_width-1:0] regs_q; | ||
end | ||
|
||
integer i; | ||
always_ff @(posedge clk_i) begin | ||
//hadle reset signals (nrst_i & dump_i) | ||
if (~rst_ni || dump_i) begin | ||
for (i = 0; i < Nb_of_regs; i++) begin : reset_cvxif_regs | ||
regs_q[i] <= 9'b0; | ||
end | ||
wb_pointer_q <= 0; | ||
end | ||
if(we_i) begin | ||
regs_q[wb_pointer_q] <= wb_data_i; | ||
wb_pointer_q <= wb_pointer_q + 1; | ||
end | ||
end | ||
|
||
endmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include <stdint.h> | ||
#include "uart.h" | ||
|
||
int main(void) | ||
{ | ||
char a = -10; | ||
char* a_addr = &a; | ||
|
||
for(char i = 0; i < 150; i++){ | ||
asm volatile("lbc x0 0(%0)" | ||
: | ||
: "r" (a_addr) | ||
); | ||
asm volatile("lbcu x0 0(%0)" | ||
: | ||
: "r" (a_addr) | ||
); | ||
asm volatile("lb x0 0(%0)" | ||
: | ||
: "r" (a_addr) | ||
); | ||
asm volatile("lbu x0 0(%0)" | ||
: | ||
: "r" (a_addr) | ||
); | ||
} | ||
|
||
uint8_t message[12] = "Hello World"; | ||
UART_init(&g_uart_0, | ||
UART_115200_BAUD, | ||
UART_DATA_8_BITS | UART_NO_PARITY | UART_ONE_STOP_BIT); | ||
|
||
UART_polled_tx_string(&g_uart_0, message); | ||
|
||
while(UART_tx_complete(&g_uart_0)==0); | ||
|
||
return(0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters