diff --git a/README.md b/README.md index cc23d57..7698637 100644 --- a/README.md +++ b/README.md @@ -59,4 +59,6 @@ Then drag the executable onto the RP2040 drive on the desktop. ## Special Thanks -Christopher Lozinski (@clozinski) - wrote this README file. Thank you! \ No newline at end of file +Christopher Lozinski (@clozinski) - wrote this README file. Thank you! +josuah (@josuah.demangeon) - helped answer questions during the development of this project +venkat_tv (@venkat_tv) - developed the pico-ice hardware \ No newline at end of file diff --git a/fpga.pio b/fpga.pio index 041c800..cc57075 100644 --- a/fpga.pio +++ b/fpga.pio @@ -1,57 +1,101 @@ .pio_version 0 +; green +.define public DIR_PIN 12 +; red +.define public REQ_PIN 13 +; blue +.define public FIN_PIN 15 +.define public CLK_PIN 24 .program fpga -.fifo rx -set x, 8 +start: +set x, 0 +mov x, ~x +mov osr, x ; set pins to out +out pindirs, 8 ; ... +set pindirs, 0b11 ; ... +set pins, 0b01 ; set dir to 1 and req to 0 +irq wait 0 ; wait for system to be ready + +wait 1 gpio CLK_PIN +wait 0 gpio CLK_PIN + +set pins, 0b11 ; set dir and req to 1 + +send_data_loop: +set x, 0 ; set x to 0 +mov x, ~x +pull noblock ; get data from memory +mov x, ~osr +jmp !x recv_data_start ; check for end of values +mov osr, ~x +wait 1 gpio CLK_PIN ; synchronize +wait 0 gpio CLK_PIN ; synchronize +out pins, 8 ; output data to pins +jmp send_data_loop ; keep sending since no null-terminator + +recv_data_start: +set pins, 0b00 ; set dir and req to 0 +set x, 0 ; reset x to 0 +mov osr, x ; set pins to in +out pindirs, 8 ; ... +set pindirs, 0b01 ; ... +wait 1 gpio REQ_PIN ; wait for data to be ready, indicated by req signal high .wrap_target - -in x, 4 -in null, 4 -push - -in pins, 8 [1] -push - -in x, 4 -in null, 4 -push - -in pins, 8 [1] -push - -.wrap +wait 1 gpio CLK_PIN ; synchronize +wait 0 gpio CLK_PIN ; synchronize +in pins, 8 ; read data from pins +push noblock ; write data to memory +jmp pin start ; stop receiving data if FPGA is done +.wrap ; otherwise keep receiving data % c-sdk { #include -#ifndef DMA_CHANNEL -#define DMA_CHANNEL 0 -#endif//DMA_CHANNEL +static int command_dma_channel; +static int frame_dma_channel; -static uint8_t frame_buffer[2][FRAME_WIDTH * FRAME_HEIGHT * 16 / 8] = { }; -static bool current_frame = false; - -static inline void fpga_program_init(PIO pio, uint sm, uint offset, uint pin_base, float div) +static void fpga_program_init(PIO pio, uint sm, uint offset, uint bus_base, uint status_base, uint fin_pin) { { pio_sm_config c = fpga_program_get_default_config(offset); - sm_config_set_in_pins(&c, pin_base); - pio_sm_set_consecutive_pindirs(pio, sm, pin_base, 8, false); + sm_config_set_in_pins(&c, bus_base); + sm_config_set_out_pins(&c, bus_base, 8); + sm_config_set_set_pins(&c, status_base, 2); + sm_config_set_jmp_pin(&c, fin_pin); sm_config_set_in_shift(&c, false, false, 8); + sm_config_set_out_shift(&c, false, false, 8); pio_sm_init(pio, sm, offset, &c); + + for (int i = 0; i < 8; i++) { pio_gpio_init(pio, bus_base + i); } + for (int i = 0; i < 2; i++) { pio_gpio_init(pio, status_base + i); } + } + + command_dma_channel = dma_claim_unused_channel(true); + frame_dma_channel = dma_claim_unused_channel(true); + + { + dma_channel_config c = dma_channel_get_default_config(command_dma_channel); + channel_config_set_read_increment(&c, true); + channel_config_set_write_increment(&c, false); + channel_config_set_transfer_data_size(&c, DMA_SIZE_8); + channel_config_set_dreq(&c, pio_get_dreq(pio, sm, true)); + channel_config_set_chain_to(&c, frame_dma_channel); + + dma_channel_configure(command_dma_channel, &c, &pio->txf[sm], NULL, 0, false); } { - dma_channel_config c = dma_channel_get_default_config(DMA_CHANNEL); + dma_channel_config c = dma_channel_get_default_config(frame_dma_channel); channel_config_set_read_increment(&c, false); channel_config_set_write_increment(&c, true); channel_config_set_transfer_data_size(&c, DMA_SIZE_8); channel_config_set_dreq(&c, pio_get_dreq(pio, sm, false)); - dma_channel_configure(DMA_CHANNEL, &c, NULL, &pio->rxf[sm], FRAME_WIDTH * FRAME_HEIGHT * 2 + 1, false); + dma_channel_configure(frame_dma_channel, &c, NULL, &pio->rxf[sm], FRAME_WIDTH * FRAME_HEIGHT * 2, false); } } %} \ No newline at end of file diff --git a/ice/constraints.pdc b/ice/constraints.pdc index 950db4c..0f11903 100644 --- a/ice/constraints.pdc +++ b/ice/constraints.pdc @@ -1,5 +1,7 @@ ldc_set_location -site 35 [get_ports {clk}] -ldc_set_location -site 14 [get_ports {start}] +ldc_set_location -site 41 [get_ports {req}] +ldc_set_location -site 40 [get_ports {fin}] +ldc_set_location -site 39 [get_ports {dir}] ldc_set_location -site 27 [get_ports {data[0]}] ldc_set_location -site 25 [get_ports {data[1]}] diff --git a/ice/constraints.sdc b/ice/constraints.sdc index 6f1a301..c480413 100644 --- a/ice/constraints.sdc +++ b/ice/constraints.sdc @@ -1 +1 @@ -create_clock -period 20.8333 [get_ports {clk}] \ No newline at end of file +create_clock -period 20.8333333 [get_ports {clk}] \ No newline at end of file diff --git a/ice/mandelbrot/.ng_run_manager.ini b/ice/mandelbrot/.ng_run_manager.ini new file mode 100644 index 0000000..2d2a62a --- /dev/null +++ b/ice/mandelbrot/.ng_run_manager.ini @@ -0,0 +1,8 @@ +[Runmanager] +Geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\0\0\0\0\0\x14\0\0\x1\xca\0\0\0\xb9\0\0\0\0\0\0\0\x14\0\0\x1\xca\0\0\0\xb9\0\0\0\0\0\0\0\0\n\0\0\0\0\0\0\0\0\x14\0\0\x1\xca\0\0\0\xb9) +headerState=@ByteArray(\0\0\0\xff\0\0\0\0\0\0\0\x1\0\0\0\x1\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\x15\0\xf0\x1f\0\0\0\t\0\0\0\f\0\0\0\x64\0\0\0\r\0\0\0\x64\0\0\0\x12\0\0\0\x64\0\0\0\x13\0\0\0\x64\0\0\0\x10\0\0\0\x64\0\0\0\x11\0\0\0\x64\0\0\0\x14\0\0\0\x64\0\0\0\xe\0\0\0\x64\0\0\0\xf\0\0\0\x64\0\0\x5\xf\0\0\0\x15\x1\x1\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\x64\xff\xff\xff\xff\0\0\0\x84\0\0\0\0\0\0\0\x15\0\0\0\xc3\0\0\0\x1\0\0\0\0\0\0\0\x64\0\0\0\x1\0\0\0\0\0\0\0\x64\0\0\0\x1\0\0\0\0\0\0\0\x64\0\0\0\x1\0\0\0\0\0\0\0\x64\0\0\0\x1\0\0\0\0\0\0\0\x64\0\0\0\x1\0\0\0\0\0\0\0\x64\0\0\0\x1\0\0\0\0\0\0\0\x64\0\0\0\x1\0\0\0\0\0\0\0\x64\0\0\0\x1\0\0\0\0\0\0\0\x64\0\0\0\x1\0\0\0\0\0\0\0\x64\0\0\0\x1\0\0\0\0\0\0\0\x64\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\x3\xe8\0\0\0\0\x64) + +[impl_1%3CStrategy1%3E] +isChecked=false +isHidden=false +isExpanded=false diff --git a/ice/mandelbrot/.recovery b/ice/mandelbrot/.recovery index 64f3127..233b638 100644 --- a/ice/mandelbrot/.recovery +++ b/ice/mandelbrot/.recovery @@ -4,7 +4,10 @@ - + + + + diff --git a/ice/mandelbrot/.setting.ini b/ice/mandelbrot/.setting.ini new file mode 100644 index 0000000..2447d4e --- /dev/null +++ b/ice/mandelbrot/.setting.ini @@ -0,0 +1,7 @@ +[General] +IdFilter=@Invalid() +ProcessFilter=@Invalid() +TypeFilter=0 + +[Individuals] +size=0 diff --git a/ice/mandelbrot/drc.log b/ice/mandelbrot/drc.log index ca3fad6..381fd25 100644 --- a/ice/mandelbrot/drc.log +++ b/ice/mandelbrot/drc.log @@ -1,6 +1,3 @@ DRC: Design Rule Check Radiant Software (64-bit) 2024.1.0.34.2 -Wed Sep 25 13:18:59 2024 +Sat Sep 28 23:33:51 2024 -WARNING <71003020> - Top module port 'start' does not connect to anything. -ERROR <71003010> - The port [clk] is assigned to a nonexistent pin [35]. Reassign the port to a valid pin. -ERROR <71003010> - The port [data[0]] is assigned to a nonexistent pin [27]. Reassign the port to a valid pin. diff --git a/ice/mandelbrot/mandelbrot.rdf b/ice/mandelbrot/mandelbrot.rdf index 5831f4b..d0ea781 100644 --- a/ice/mandelbrot/mandelbrot.rdf +++ b/ice/mandelbrot/mandelbrot.rdf @@ -1,9 +1,12 @@ - + - + + + + diff --git a/ice/mandelbrot/mandelbrot_tcl.html b/ice/mandelbrot/mandelbrot_tcl.html index a7d9fc4..7e8dc3f 100644 --- a/ice/mandelbrot/mandelbrot_tcl.html +++ b/ice/mandelbrot/mandelbrot_tcl.html @@ -40,8 +40,153 @@ if (a)
+pn240928081403
+#Start recording tcl command: 9/25/2024 13:09:03
+#Project Location: C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/mandelbrot; Project name: mandelbrot
+prj_create -name "mandelbrot" -impl "impl_1" -dev iCE40UP5K-UWG30ITR -performance "High-Performance_1.2V" -synthesis "synplify"
+prj_add_source "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/top.sv" "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/constraints.sdc" "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/constraints.pdc"
+prj_save 
+prj_remove_source "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/top.sv"
+prj_add_source "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/top.sv"
+prj_remove_source "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/top.sv"
+prj_add_source "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/mandelbrot/impl_1/top.sv"
+prj_remove_source "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/mandelbrot/impl_1/top.sv"
+prj_add_source "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/mandelbrot/source/impl_1/top.sv"
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_set_device -part iCE40UP5K-SG48I -performance "High-Performance_1.2V"
+prj_run Synthesis -impl impl_1
+prj_run Map -impl impl_1
+prj_run Map -impl impl_1
+prj_run Export -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_add_source "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/spi.sv"
+prj_remove_source "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/spi.sv"
+prj_add_source "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/top.sv"
+prj_remove_source "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/top.sv"
+prj_add_source "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/spi.sv"
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run PAR -impl impl_1
+prj_run PAR -impl impl_1
+prj_run PAR -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_add_source "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/xd.sv"
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_remove_source "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/xd.sv"
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_remove_source "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/spi.sv"
+prj_add_source "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/spi.sv"
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run Export -impl impl_1
+prj_add_source "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/ram.sv"
+prj_disable_source "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/ram.sv"
+prj_enable_source "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/ram.sv"
+prj_remove_source "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/ram.sv"
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_remove_source "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/spi.sv"
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+prj_run PAR -impl impl_1
+prj_run Export -impl impl_1
+#Stop recording: 9/28/2024 08:14:03
+
+
+
+pn241002102238
+#Start recording tcl command: 10/2/2024 09:00:03
+#Project Location: C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/mandelbrot; Project name: mandelbrot
+prj_open "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/mandelbrot/mandelbrot.rdf"
+prj_add_source "C:/Users/fuzzc/Documents/Hardware/pico-ice/pico-ice-video/ice/ram.sv"
+#Stop recording: 10/2/2024 10:22:38
+
+
+
 
+ +