Skip to content

PR to update the tutorial Makefiles #32

Open
@jaimebw

Description

@jaimebw

Hi Obijuan,
First of all, thanks for the awesome tutorial. It is really helping me start my (open-source) journey with FPGAs.
I don't know if you would be interested in updating some of the Makefiles/docs for some updated resources.
Mainly, arachne-pnr is no longer supported, so I have been updating everything to use a nextpnr.
I can definitely try to push the changes once I've gone through the whole tutorial.

Activity

jaimebw

jaimebw commented on Mar 22, 2025

@jaimebw
Author

The main changes are like from this:

#-- Compilar
iverilog $^ -o $(NAME)_tb.out
#-- Simular
./$(NAME)_tb.out
#-- Ver visualmente la simulacion con gtkwave
gtkwave $@ $(NAME)_tb.gtkw &

To something like this:

	#-- Compilar
	iverilog -o $(NAME)_tb.out $(NAME)_tb.v $(NAME).v
	#-- Simular
	./$(NAME)_tb.out
	
	#-- Ver visualmente la simulacion con gtkwave
	gtkwave $@ $(NAME)_tb.gtkw &

Same here:

$(NAME).bin: $(NAME).pcf $(NAME).v
#-- Sintesis
yosys -p "synth_ice40 -blif $(NAME).blif" $(NAME).v
#-- Place & route
arachne-pnr -d 8k -p $(NAME).pcf $(NAME).blif -o $(NAME).txt
#-- Generar binario final, listo para descargar en fgpa
icepack $(NAME).txt $(NAME).bin

To something like this:

	#-- Sintesis
	yosys -p "synth_ice40 -top $(NAME) -json $(NAME).json" $(NAME).v
	
	#-- Place & route

	nextpnr-ice40 --lp1k --json $(NAME).json --pcf $(NAME).pcf --asc $(NAME).asc
	#-- Generar binario final, listo para descargar en fgpa
	icepack $(NAME).asc $(NAME).bin

I'm currently running under MacOs.

Also, there are some issues when I compile Verilog. Mainly, it has to do with re-declaring wires like in:

module Fport(output [3:0] data);
//-- La salida del modulo son 4 cables
wire [3:0] data;
//-- Sacar el valor por el bus de salida
//-- En verilog se indica primero el numero de bits
//-- y luego el formato (binario, hexa, decimal, etc...)
//-- Para sacar el valor en hexa hay que poner: 4'h4
assign data = 4'b1010; //-- 4'hA
endmodule

It complains and I have read that the newer standards do not let you declare explicitly that way. Corrected (more like more correct example):

odule Fport(output [3:0] data);

  //-- La salida del modulo son 4 cables
  //wire [3:0] data;

  //-- Sacar el valor por el bus de salida
  //-- En verilog se indica primero el numero de bits
  //-- y luego el formato (binario, hexa, decimal, etc...)
  //-- Para sacar el valor en hexa hay que poner: 4'h4
  assign data = 4'b1010; //-- 4'hA

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jaimebw

        Issue actions

          PR to update the tutorial Makefiles · Issue #32 · Obijuan/open-fpga-verilog-tutorial