Hi, could someone please guide me about how we can...
# caravel
r
Hi, could someone please guide me about how we can change the various wishbone signals including the i_wb_data, i_wb_addr, i_wb_en, etc.? Like, if I need to read certain data at a certain time from the wishbone, how do I go about doing that. @Matt Venn uses the following wishbone example:

https://www.youtube.com/watch?v=jEQnLxADgr0&ab_channel=ZeroToASICCourse

Whilst testing it, the firmware is as follows:
Copy code
#include "verilog/dv/caravel/defs.h"
#include "verilog/dv/caravel/stub.c"

/*
	IO Test:
		- Configures MPRJ lower 8-IO pins as outputs
		- Observes counter value through the MPRJ lower 8 IO pins (in the testbench)
*/

#define reg_wb_leds      (*(volatile uint32_t*)0x30000000)
#define reg_wb_buttons   (*(volatile uint32_t*)0x30000004)


void main()
{
	/* 
	IO Control Registers
	| DM     | VTRIP | SLOW  | AN_POL | AN_SEL | AN_EN | MOD_SEL | INP_DIS | HOLDH | OEB_N | MGMT_EN |
	| 3-bits | 1-bit | 1-bit | 1-bit  | 1-bit  | 1-bit | 1-bit   | 1-bit   | 1-bit | 1-bit | 1-bit   |
	Output: 0000_0110_0000_1110  (0x1808) = GPIO_MODE_USER_STD_OUTPUT
	| DM     | VTRIP | SLOW  | AN_POL | AN_SEL | AN_EN | MOD_SEL | INP_DIS | HOLDH | OEB_N | MGMT_EN |
	| 110    | 0     | 0     | 0      | 0      | 0     | 0       | 1       | 0     | 0     | 0       |
	
	 
	Input: 0000_0001_0000_1111 (0x0402) = GPIO_MODE_USER_STD_INPUT_NOPULL
	| DM     | VTRIP | SLOW  | AN_POL | AN_SEL | AN_EN | MOD_SEL | INP_DIS | HOLDH | OEB_N | MGMT_EN |
	| 001    | 0     | 0     | 0      | 0      | 0     | 0       | 0       | 0     | 1     | 0       |
	*/

	/* Set up the housekeeping SPI to be connected internally so	*/
	/* that external pin changes don't affect it.			*/

	reg_spimaster_config = 0xa002;	// Enable, prescaler = 2,
                                        // connect to housekeeping SPI

	// Connect the housekeeping SPI to the SPI master
	// so that the CSB line is not left floating.  This allows
	// all of the GPIO pins to be used for user functions.

	// Configure lower 8-IOs as user output
	// Observe counter value in the testbench
	reg_mprj_io_7 =  GPIO_MODE_USER_STD_INPUT_NOPULL;
	reg_mprj_io_8 =  GPIO_MODE_USER_STD_INPUT_NOPULL;
	reg_mprj_io_9 =  GPIO_MODE_USER_STD_INPUT_NOPULL;

	reg_mprj_io_10 =  GPIO_MODE_USER_STD_OUTPUT;
	reg_mprj_io_11 =  GPIO_MODE_USER_STD_OUTPUT;
	reg_mprj_io_12 =  GPIO_MODE_USER_STD_OUTPUT;
	reg_mprj_io_13 =  GPIO_MODE_USER_STD_OUTPUT;
	reg_mprj_io_14 =  GPIO_MODE_USER_STD_OUTPUT;
	reg_mprj_io_15 =  GPIO_MODE_USER_STD_OUTPUT;
	reg_mprj_io_16 =  GPIO_MODE_USER_STD_OUTPUT;
	reg_mprj_io_17 =  GPIO_MODE_USER_STD_OUTPUT;

	/* Apply configuration */
	reg_mprj_xfer = 1;
	while (reg_mprj_xfer == 1);

    // wait for all 3 buttons to get pressed
    while (reg_wb_buttons != 7);

    // then set all the leds, signalling the end of the test
    reg_wb_leds = 0xFF;

}
Where are the wishbone signals being set? I'm new to this harness, any help would be appreciated~!
m
a memory address is made reg_wb_leds, and then writing to that writes to memory, which then gets sent over the wishbone bus
same for the read
things have changed a bit though, please check the section in the FAQ
r
So it's sent whenever it's written, in this case, it's written via the firmware when we set reg_wb_leds=0xFF?