mirror of
https://github.com/YosysHQ/yosys
synced 2025-07-30 07:53:16 +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
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