I'm trying to read sys_rdata content from a simple led module I've created. The module also receives an index passed using the "monitor" command, and blinks the LED of that index.
Below is the bit of code in my led.sv module, that reads (from sys_wdata) and writes (to sys_rdata):
Code: Select all
always_ff @(posedge clk_i) begin
if (~rstn_i) begin
// Reset logic here
end else if (sys_wen) begin
// Decode address and write registers here
// if (sys_addr[19:0] == 20'h00054) begin
// // Write logic for the specific address
// end
if (sys_addr[31:0] == 32'h40300058) begin
// Write logic for the specific address
led_index <= sys_wdata[31:29];
end
end
end
always_comb begin
case (sys_addr[31:0])
32'h40300050: sys_rdata <= 32'hFEEDBACC; // ID
default: sys_rdata <= 32'h00000000;
endcase
end
I did managed to receive the ID value (0xfeedbacc) when executing the "monitor 0x40300050" command using PuTTY.
Here is the code I'm using to send the Index value to the FPGA from my console app:
Code: Select all
// Execute the "monitor" command to set LED 3'hA00 => 5
std::string monitorCommand = "/opt/redpitaya/bin/monitor 0x40300058 0xA0000000\n";
rc = ssh_channel_write(channel, monitorCommand.c_str(), monitorCommand.length());
if (rc < 0) {
std::cout << "Error writing to channel: " << ssh_get_error(my_ssh_session) << std::endl;
return 1;
}
Thanks!