Skip to content

Conversation

gatecat
Copy link
Contributor

@gatecat gatecat commented May 14, 2025

Everything else is ready for review, although I have a couple of questions:

  • should this be in this repo at all, or a different one?
  • should the top level wrapper still use amaranth-orchard pin signatures, as it does now, or is it clearer if it defines the pin signatures in the wrapper too (e.g. as an example for people who want to wrap Verilog with other types of IO)

@gatecat gatecat requested a review from robtaylor May 14, 2025 07:16
@gatecat gatecat force-pushed the add-verilog-example branch 3 times, most recently from b426930 to f9a4d9c Compare May 14, 2025 08:42
@robtaylor
Copy link
Contributor

I think it belongs here. Defining the iopins here is better as well.

Let's not add a makefile - it was removed from the others.
Trying to keep things as windows compatible as we can, though still need to test.

@gatecat
Copy link
Contributor Author

gatecat commented May 14, 2025

Let's not add a makefile - it was removed from the others.

Seems like it wasn't? e.g. https://github.com/ChipFlow/chipflow-examples/blob/main/mcu_soc/Makefile

@gatecat gatecat force-pushed the add-verilog-example branch from f9a4d9c to 7d0876e Compare May 14, 2025 14:44
@gatecat gatecat force-pushed the add-verilog-example branch 3 times, most recently from 91ced06 to 8e2c516 Compare June 23, 2025 07:55
@robtaylor robtaylor force-pushed the add-verilog-example branch 2 times, most recently from 91ced06 to 210cfbd Compare June 23, 2025 07:58
@gatecat gatecat force-pushed the add-verilog-example branch from 210cfbd to e7dde63 Compare July 14, 2025 08:16
@gatecat gatecat marked this pull request as ready for review July 14, 2025 08:16
@gatecat gatecat force-pushed the add-verilog-example branch from e7dde63 to e64bf92 Compare July 14, 2025 08:17
@gatecat
Copy link
Contributor Author

gatecat commented Jul 14, 2025

Hopefully once ChipFlow/chipflow-lib#129 is in this is ready to go!

@gatecat gatecat force-pushed the add-verilog-example branch from e64bf92 to 90cb442 Compare July 14, 2025 10:13
Comment on lines 50 to 44
base = os.path.dirname(__file__)

verilog_sources = [
f"{base}/picosoc_asic_top.v",
f"{base}/picorv32/picosoc/spimemio.v",
f"{base}/picorv32/picosoc/simpleuart.v",
f"{base}/picorv32/picosoc/picosoc.v",
f"{base}/picorv32/picorv32.v",
]

for verilog_file in verilog_sources:
with open(verilog_file, 'r') as f:
platform.add_file(verilog_file, f)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering, could we have a chipflow.toml section to include external code, or maybe use a seperate toml file for defining the import?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any progress on this?

Comment on lines +65 to +74
# Clock and reset
i_clk=ClockSignal(),
i_resetn=~ResetSignal(),

# UART
o_ser_tx=self.uart_0.tx.o,
i_ser_rx=self.uart_0.rx.i,

# SPI flash
o_flash_csb=self.flash.csn.o,
o_flash_clk=self.flash.clk.o,

o_flash_io0_oe=self.flash.d.oe[0],
o_flash_io1_oe=self.flash.d.oe[1],
o_flash_io2_oe=self.flash.d.oe[2],
o_flash_io3_oe=self.flash.d.oe[3],

o_flash_io0_do=self.flash.d.o[0],
o_flash_io1_do=self.flash.d.o[1],
o_flash_io2_do=self.flash.d.o[2],
o_flash_io3_do=self.flash.d.o[3],

i_flash_io0_di=self.flash.d.i[0],
i_flash_io1_di=self.flash.d.i[1],
i_flash_io2_di=self.flash.d.i[2],
i_flash_io3_di=self.flash.d.i[3],

# LEDs
o_leds=self.gpio_0.gpio.o
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, might be something worth putting in a toml description?

@gatecat gatecat force-pushed the add-verilog-example branch 4 times, most recently from 6b8a786 to 1e3fed9 Compare September 16, 2025 07:12
@gatecat
Copy link
Contributor Author

gatecat commented Sep 16, 2025

@robtaylor as "proper" Verilog support has turned into a bigger project, shall we at least get this merged in its current form (I've rebased and updated it, I don't think any of the other PRs should affect it) so we have some kind of Verilog example to point to?

@robtaylor
Copy link
Contributor

@robtaylor as "proper" Verilog support has turned into a bigger project, shall we at least get this merged in its current form (I've rebased and updated it, I don't think any of the other PRs should affect it) so we have some kind of Verilog example to point to?

Yes @gatecat , sounds sensible to me. Can you rebase now software-rework has landed?

@gatecat gatecat force-pushed the add-verilog-example branch 2 times, most recently from b0c279e to 9a82105 Compare September 29, 2025 12:42
@gatecat gatecat force-pushed the add-verilog-example branch from 9a82105 to 8086479 Compare September 29, 2025 12:45
@gatecat
Copy link
Contributor Author

gatecat commented Sep 29, 2025

Rebasing ended up a bit more complex than expected, but with ChipFlow/chipflow-lib#143, I think this should now be working

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't think this should be necessary now?

if the chipflow-lib impl doesnt do something you need, lets fix that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be a ton of work to get software building working with Verilog, and I don't think everyone is even going to want this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the flashio/cmd_read_*/set_flash parts here be in the QSPIFlash driver?
Maybe fix up chipflow-lib if drivers need a way to put stuff in start.S?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The picosoc qspi flash core isn't compatible with the one in chipflow-digital-ip so different drivers is needed

}

void print_dec(uint32_t v)
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not something like:
do // run at least once to print 0
{
d = x % 10;
stack[sp++] = d + '0'; // push
x /= 10;
} while (x);

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, this was just taken from claire's picosoc code as-is

Comment on lines 50 to 44
base = os.path.dirname(__file__)

verilog_sources = [
f"{base}/picosoc_asic_top.v",
f"{base}/picorv32/picosoc/spimemio.v",
f"{base}/picorv32/picosoc/simpleuart.v",
f"{base}/picorv32/picosoc/picosoc.v",
f"{base}/picorv32/picorv32.v",
]

for verilog_file in verilog_sources:
with open(verilog_file, 'r') as f:
platform.add_file(verilog_file, f)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any progress on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants