mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 03:32:29 +00:00 
			
		
		
		
	Add initial support for both MAX10 and Cyclone IV (E|GX) FPGAs
This commit is contained in:
		
							parent
							
								
									fcb274a564
								
							
						
					
					
						commit
						c27dcc1e47
					
				
					 25 changed files with 2255 additions and 0 deletions
				
			
		
							
								
								
									
										4
									
								
								examples/intel/DE2i-150/quartus_compile/de2i.qpf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								examples/intel/DE2i-150/quartus_compile/de2i.qpf
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,4 @@ | |||
| QUARTUS_VERSION = "16.1" | ||||
| # Revisions | ||||
| 
 | ||||
| PROJECT_REVISION = "de2i" | ||||
							
								
								
									
										1099
									
								
								examples/intel/DE2i-150/quartus_compile/de2i.qsf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1099
									
								
								examples/intel/DE2i-150/quartus_compile/de2i.qsf
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										7
									
								
								examples/intel/DE2i-150/quartus_compile/runme_quartus
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								examples/intel/DE2i-150/quartus_compile/runme_quartus
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,7 @@ | |||
| #!/bin/bash | ||||
| 
 | ||||
| export REV="de2i" | ||||
| 
 | ||||
| quartus_map -c $REV top && \ | ||||
|     quartus_fit -c $REV top && \ | ||||
| 	    quartus_asm -c $REV top | ||||
							
								
								
									
										2
									
								
								examples/intel/DE2i-150/run_cycloneiv
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								examples/intel/DE2i-150/run_cycloneiv
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,2 @@ | |||
| #/bin/env bash | ||||
| yosys -p "synth_intel -family cycloneiv -top top -vout top.vqm" top.v sevenseg.v | ||||
							
								
								
									
										25
									
								
								examples/intel/DE2i-150/sevenseg.v
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								examples/intel/DE2i-150/sevenseg.v
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,25 @@ | |||
| module sevenseg ( output reg [6:0] HEX0, | ||||
|                   input      [3:0] SW ); | ||||
| 
 | ||||
|    always @(*) begin | ||||
|      case(SW) | ||||
|         4'h1: HEX0 = 7'b1111001;	 | ||||
| 	4'h2: HEX0 = 7'b0100100; 	 | ||||
| 	4'h3: HEX0 = 7'b0110000; 	 | ||||
| 	4'h4: HEX0 = 7'b0011001; 	 | ||||
| 	4'h5: HEX0 = 7'b0010010; 	 | ||||
| 	4'h6: HEX0 = 7'b0000010; 	 | ||||
| 	4'h7: HEX0 = 7'b1111000; 	 | ||||
| 	4'h8: HEX0 = 7'b0000000; 	 | ||||
| 	4'h9: HEX0 = 7'b0011000; 	 | ||||
| 	4'ha: HEX0 = 7'b0001000; | ||||
| 	4'hb: HEX0 = 7'b0000011; | ||||
| 	4'hc: HEX0 = 7'b1000110; | ||||
| 	4'hd: HEX0 = 7'b0100001; | ||||
| 	4'he: HEX0 = 7'b0000110; | ||||
| 	4'hf: HEX0 = 7'b0001110; | ||||
| 	4'h0: HEX0 = 7'b1000000; | ||||
|      endcase // case (SW) | ||||
|    end  | ||||
|     | ||||
| endmodule | ||||
							
								
								
									
										15
									
								
								examples/intel/DE2i-150/top.v
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								examples/intel/DE2i-150/top.v
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,15 @@ | |||
| `default_nettype none | ||||
| module top ( output wire [6:0] HEX0, HEX1, HEX2, HEX3, HEX4, HEX5, HEX6, HEX7, | ||||
|              input  wire [15:0] SW ); | ||||
|               | ||||
|    | ||||
|     sevenseg UUD0 (.HEX0(HEX0), .SW(4'h7)); | ||||
|     sevenseg UUD1 (.HEX0(HEX1), .SW(4'h1)); | ||||
|     sevenseg UUD2 (.HEX0(HEX2), .SW(4'h0)); | ||||
|     sevenseg UUD3 (.HEX0(HEX3), .SW(4'h2)); | ||||
|     sevenseg UUD4 (.HEX0(HEX4), .SW(SW[3:0])); | ||||
|     sevenseg UUD5 (.HEX0(HEX5), .SW(SW[7:4])); | ||||
|     sevenseg UUD6 (.HEX0(HEX6), .SW(SW[11:8])); | ||||
|     sevenseg UUD7 (.HEX0(HEX7), .SW(SW[15:12])); | ||||
|      | ||||
| endmodule | ||||
							
								
								
									
										1
									
								
								examples/intel/MAX10/run_max10
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								examples/intel/MAX10/run_max10
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| yosys -p "synth_intel -family max10 -top top -vout top.vqm" top.v sevenseg.v | ||||
							
								
								
									
										5
									
								
								examples/intel/MAX10/runme_postsynth
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								examples/intel/MAX10/runme_postsynth
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| #!/bin/bash | ||||
| 
 | ||||
| iverilog -D POST_IMPL -o verif_post -s tb_top tb_top.v top.vqm $(yosys-config --datdir/altera_intel/max10/cells_comb_max10.v) | ||||
| vvp -N verif_post | ||||
| 
 | ||||
							
								
								
									
										25
									
								
								examples/intel/MAX10/sevenseg.v
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								examples/intel/MAX10/sevenseg.v
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,25 @@ | |||
| module sevenseg ( output reg [6:0] HEX0, | ||||
|                   input      [3:0] SW ); | ||||
| 
 | ||||
|    always @(*) begin | ||||
|      case(SW) | ||||
|         4'h1: HEX0 = 7'b1111001;	 | ||||
| 	4'h2: HEX0 = 7'b0100100; 	 | ||||
| 	4'h3: HEX0 = 7'b0110000; 	 | ||||
| 	4'h4: HEX0 = 7'b0011001; 	 | ||||
| 	4'h5: HEX0 = 7'b0010010; 	 | ||||
| 	4'h6: HEX0 = 7'b0000010; 	 | ||||
| 	4'h7: HEX0 = 7'b1111000; 	 | ||||
| 	4'h8: HEX0 = 7'b0000000; 	 | ||||
| 	4'h9: HEX0 = 7'b0011000; 	 | ||||
| 	4'ha: HEX0 = 7'b0001000; | ||||
| 	4'hb: HEX0 = 7'b0000011; | ||||
| 	4'hc: HEX0 = 7'b1000110; | ||||
| 	4'hd: HEX0 = 7'b0100001; | ||||
| 	4'he: HEX0 = 7'b0000110; | ||||
| 	4'hf: HEX0 = 7'b0001110; | ||||
| 	4'h0: HEX0 = 7'b1000000; | ||||
|      endcase // case (SW) | ||||
|    end  | ||||
|     | ||||
| endmodule | ||||
							
								
								
									
										15
									
								
								examples/intel/MAX10/top.v
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								examples/intel/MAX10/top.v
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,15 @@ | |||
| `default_nettype none | ||||
| module top ( output wire [6:0] HEX0, HEX1, HEX2, HEX3, HEX4, HEX5, HEX6, HEX7, | ||||
|              input  wire [15:0] SW ); | ||||
|               | ||||
|    | ||||
|     sevenseg UUD0 (.HEX0(HEX0), .SW(4'h7)); | ||||
|     sevenseg UUD1 (.HEX0(HEX1), .SW(4'h1)); | ||||
|     sevenseg UUD2 (.HEX0(HEX2), .SW(4'h0)); | ||||
|     sevenseg UUD3 (.HEX0(HEX3), .SW(4'h2)); | ||||
|     sevenseg UUD4 (.HEX0(HEX4), .SW(SW[3:0])); | ||||
|     sevenseg UUD5 (.HEX0(HEX5), .SW(SW[7:4])); | ||||
|     sevenseg UUD6 (.HEX0(HEX6), .SW(SW[11:8])); | ||||
|     sevenseg UUD7 (.HEX0(HEX7), .SW(SW[15:12])); | ||||
|      | ||||
| endmodule | ||||
							
								
								
									
										6
									
								
								examples/intel/asicworld_lfsr/README
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								examples/intel/asicworld_lfsr/README
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | |||
| Source of the files: | ||||
| http://www.asic-world.com/examples/verilog/lfsr.html | ||||
| 
 | ||||
| Run first: runme_presynth | ||||
| Generate output netlist with run_max10 or run_cycloneiv | ||||
| Then, check with: runme_postsynth | ||||
							
								
								
									
										35
									
								
								examples/intel/asicworld_lfsr/lfsr_updown.v
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								examples/intel/asicworld_lfsr/lfsr_updown.v
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,35 @@ | |||
| `default_nettype none | ||||
| module lfsr_updown ( | ||||
| clk       ,   // Clock input | ||||
| reset     ,   // Reset input | ||||
| enable    ,   // Enable input | ||||
| up_down   ,   // Up Down input | ||||
| count     ,   // Count output | ||||
| overflow      // Overflow output | ||||
| ); | ||||
| 
 | ||||
|  input clk; | ||||
|  input reset; | ||||
|  input enable;  | ||||
|  input up_down; | ||||
| 
 | ||||
|  output [7 : 0] count; | ||||
|  output overflow; | ||||
| 
 | ||||
|  reg [7 : 0] count; | ||||
| 
 | ||||
|  assign overflow = (up_down) ? (count == {{7{1'b0}}, 1'b1}) :  | ||||
|                                (count == {1'b1, {7{1'b0}}}) ; | ||||
| 
 | ||||
|  always @(posedge clk) | ||||
|  if (reset)  | ||||
|     count <= {7{1'b0}}; | ||||
|  else if (enable) begin | ||||
|     if (up_down) begin | ||||
|       count <= {~(^(count & 8'b01100011)),count[7:1]}; | ||||
|     end else begin | ||||
|       count <= {count[5:0],~(^(count &  8'b10110001))}; | ||||
|     end | ||||
|  end | ||||
| 
 | ||||
| endmodule | ||||
							
								
								
									
										34
									
								
								examples/intel/asicworld_lfsr/lfsr_updown_tb.v
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								examples/intel/asicworld_lfsr/lfsr_updown_tb.v
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,34 @@ | |||
| module tb(); | ||||
|  reg clk; | ||||
|  reg reset; | ||||
|  reg enable; | ||||
|  reg up_down; | ||||
| 
 | ||||
|  wire [7 : 0] count; | ||||
|  wire overflow; | ||||
| 
 | ||||
| initial begin | ||||
|   $monitor("rst %b en %b updown %b cnt %b overflow %b", | ||||
|      reset,enable,up_down,count, overflow); | ||||
|   clk = 0; | ||||
|   reset = 1; | ||||
|   enable = 0; | ||||
|   up_down = 0; | ||||
|   #10 reset = 0; | ||||
|   #1 enable = 1; | ||||
|   #20 up_down = 1; | ||||
|   #30 $finish; | ||||
| end | ||||
| 
 | ||||
| always #1 clk = ~clk; | ||||
| 
 | ||||
| lfsr_updown U( | ||||
| .clk      ( clk      ), | ||||
| .reset    ( reset    ), | ||||
| .enable   ( enable   ), | ||||
| .up_down  ( up_down  ), | ||||
| .count    ( count    ), | ||||
| .overflow ( overflow ) | ||||
| ); | ||||
| 
 | ||||
| endmodule  | ||||
							
								
								
									
										2
									
								
								examples/intel/asicworld_lfsr/run_cycloneiv
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										2
									
								
								examples/intel/asicworld_lfsr/run_cycloneiv
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,2 @@ | |||
| #!/bin/env bash | ||||
| yosys -p "synth_intel -family cycloneiv -top lfsr_updown -vout top.vqm" lfsr_updown.v | ||||
							
								
								
									
										2
									
								
								examples/intel/asicworld_lfsr/run_max10
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										2
									
								
								examples/intel/asicworld_lfsr/run_max10
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,2 @@ | |||
| #!/bin/env bash | ||||
| yosys -p "synth_intel -family max10 -top lfsr_updown -vout top.vqm" lfsr_updown.v | ||||
							
								
								
									
										5
									
								
								examples/intel/asicworld_lfsr/runme_postsynth
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										5
									
								
								examples/intel/asicworld_lfsr/runme_postsynth
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| #!/bin/bash | ||||
| 
 | ||||
| iverilog -D POST_IMPL -o verif_post -s tb lfsr_updown_tb.v top.vqm $(yosys-config --datdir/altera_intel/max10/cells_comb_max10.v) | ||||
| vvp -N verif_post | ||||
| 
 | ||||
							
								
								
									
										5
									
								
								examples/intel/asicworld_lfsr/runme_presynth
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										5
									
								
								examples/intel/asicworld_lfsr/runme_presynth
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| #!/bin/bash | ||||
| 
 | ||||
| iverilog -o presynth lfsr_updown_tb.v lfsr_updown.v &&\ | ||||
| 
 | ||||
| vvp -N presynth | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue