Hello <@U016EM8L91B> and <@U017X0NM2E7>, Thank yo...
# ieee-sscs-dc-22
m
Hello @Tim Edwards and @Mitch Bailey, Thank you guys for the super helpful information this morning! I hadn’t seen the
user_defines.v
before this mornings meeting so I took a look at it. Could you perhaps explain a little more what
user_defines.v
is used for as opposed to
mprj_por.c
? I think I’m a little mixed up on Caravel. Thanks a lot!
t
Both use the same definition names, which is a mapping of a helpful text name to a 13-bit value. One is a .h file (C-style definitions) and the other is a .v file (verilog-style definitions), but the defined 13-bit values are the same 13-bit values. The difference is that these 13-bit values are held in two different places: One is a value held at the position of the GPIO itself, which determines the reset state of the GPIO when the chip is powered up. The other value is held within the SoC and is used to program the GPIOs at any time from code running on the processor.
user_defines.v
defines the way each of the GPIO pads is configured when the chip powers up. It is the best way to make sure that your user project comes up and runs immediately on power-up, regardless of what the processor is doing. Does that sufficiently answer your question?
👍 1
m
Ah, that makes sense! Thank you!
Hello @Tim Edwards, I have one more stupid question about this: so in our repo generated from one of the user_project templates, the
caravel/
directory is another git repo…so to modify
user_defines.v
from the
caravel
repo is it expected to flatten the
caravel/
repo (i.e., remove
caravel/.git
)? Or create a fork and rebase as a submodule? Or something else? Thanks a lot! Micah
m
Copy
caravel/verilog/rtl/user_defines.v
to
verilog/rtl/user_defines.v
. From
caravel/scripts/gen_gpio_defaults.py
Copy code
if len(arguments) == 0:
        user_project_path = os.getcwd()
    else:
        user_project_path = arguments[0]
...
    vpath = user_project_path + '/verilog'
...
    user_defines_path = vpath + '/rtl/user_defines.v'
    if not os.path.isfile(user_defines_path):
        user_defines_path = caravel_path + '/verilog/rtl/user_defines.v'
The program tries to read from
verilog/rtl/user_defines.v
, but if that doesn't exist, it defaults to
caravel/verilog/rtl/user_defines.v
In other words, local settings override default caravel settings.
You shouldn't (need to) change anything in the
caravel
sub-repo.
m
@Mitch Bailey Thank you! That is super helpful! Is that procedure documented anywhere outside of the scripts?