add PLL to blinky

This commit is contained in:
2025-08-21 15:32:14 -07:00
parent 5fd2a484e5
commit 5cb0b79110
3 changed files with 37 additions and 10 deletions

View File

@@ -1,9 +1,32 @@
module blinky (input wire CLK, output wire PIN_24);
localparam N=24;
wire CLK_1;
SB_PLL40_CORE usb_pll_inst (
.REFERENCECLK(CLK),
.PLLOUTCORE(CLK_1),
.RESETB(1),
.BYPASS(0)
);
// Fin=16, Fout=1;
defparam usb_pll_inst.DIVF = 0;
defparam usb_pll_inst.DIVQ = 4;
defparam usb_pll_inst.DIVR = 0;
defparam usb_pll_inst.FILTER_RANGE = 3'b001;
defparam usb_pll_inst.FEEDBACK_PATH = "SIMPLE";
defparam usb_pll_inst.DELAY_ADJUSTMENT_MODE_FEEDBACK = "FIXED";
defparam usb_pll_inst.FDA_FEEDBACK = 4'b0000;
defparam usb_pll_inst.DELAY_ADJUSTMENT_MODE_RELATIVE = "FIXED";
defparam usb_pll_inst.FDA_RELATIVE = 4'b0000;
defparam usb_pll_inst.SHIFTREG_DIV_MODE = 2'b00;
defparam usb_pll_inst.PLLOUT_SELECT = "GENCLK";
defparam usb_pll_inst.ENABLE_ICEGATE = 1'b0;
localparam N=20;
reg [N:0] counter=0;
always @(posedge CLK)
always @(posedge CLK_1)
counter <= counter+1;
assign PIN_24=counter[N];

View File

@@ -1,6 +1,6 @@
// cribbed from https://blog.idorobots.org/entries/upduino-fpga-tutorial.html
module blinky (//input wire clk,
module blinky (input wire clk,
output wire led_blue,
output wire led_green,
output wire led_red);

View File

@@ -1,6 +1,6 @@
`default_nettype none
//`include "../verilog-6502/ALU.v"
//`include "../verilog-6502/cpu.v"
`include "../verilog-6502/ALU.v"
`include "../verilog-6502/cpu.v"
// look in pins.pcf for all the pin names on the TinyFPGA BX board
module cputest (CLK, LED, USBPU);
@@ -13,21 +13,25 @@ module cputest (CLK, LED, USBPU);
// The 6502
wire [15:0] CPU_AB;
reg [7:0] CPU_DI=8'hEA;
wire [7:0] CPU_DI=8'hEA;
wire [7:0] CPU_DO;
wire CPU_WE;
wire CPU_WE, CPU_IRQ;
wire reset;
cpu ucpu(
.clk(CLK),
.reset(1'b1),
.reset(reset),
.AB(CPU_AB),
.DI(CPU_DI),
.DO(CPU_DO),
.WE(CPU_WE),
.IRQ(1'b1),
.NMI(1'b1),
.IRQ(CPU_IRQ),
.NMI(1'b0),
.RDY(1'b1)
);
always @(*)
CPU_DI=8'hEA;
assign LED=CPU_AB[15];
endmodule