Skip to content

Commit

Permalink
Beta 0.7
Browse files Browse the repository at this point in the history
* 4.77Mhz CPU clock with 33% duty cycle, thanks to @MicroCoreLabs
* Peripheral clock now works at half cpu clock, for correct synchronisation with the 8253 timer, thanks to @kitune-san
* Turbo option is disabled for the moment, requires a redesign of the BIU... for the to-do list
  • Loading branch information
spark2k06 committed Jun 7, 2022
1 parent e8c0af4 commit 0d026a0
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 20 deletions.
18 changes: 12 additions & 6 deletions PCXT.sv
Expand Up @@ -207,7 +207,7 @@ localparam CONF_STR = {
"PCXT;;",
"-;",
"O3,Splash Screen,Yes,No;",
"O4,CPU Speed,4.77Mhz,7.16Mhz;",
//"O4,CPU Speed,4.77Mhz,7.16Mhz;",
"-;",
"OA,Adlib,On,Invisible;",
"-;",
Expand Down Expand Up @@ -315,9 +315,10 @@ wire clk_100;
wire clk_28_636;
wire clk_25;
reg clk_14_318 = 1'b0;
reg clk_7_16 = 1'b0;
//reg clk_7_16 = 1'b0;
wire clk_4_77;
wire clk_cpu;
wire peripheral_clock;

pll pll
(
Expand All @@ -344,14 +345,15 @@ wire ce_pix;
assign CLK_VIDEO = clk_28_636;
assign CE_PIXEL = 1'b1;

assign clk_cpu = status[4] ? clk_7_16 : clk_4_77;
//assign clk_cpu = status[4] ? clk_7_16 : clk_4_77;
assign clk_cpu = clk_4_77;

always @(posedge clk_28_636)
clk_14_318 <= ~clk_14_318; // 14.318Mhz


always @(posedge clk_14_318)
clk_7_16 <= ~clk_7_16; // 7.16Mhz
//always @(posedge clk_14_318)
// clk_7_16 <= ~clk_7_16; // 7.16Mhz


clk_div3 clk_normal // 4.77MHz
Expand All @@ -360,6 +362,10 @@ clk_div3 clk_normal // 4.77MHz
.clk_out(clk_4_77)
);

always @(posedge clk_4_77)
peripheral_clock <= ~peripheral_clock; // 2.385Mhz


//////////////////////////////////////////////////////////////////

wire [5:0] r, g, b;
Expand Down Expand Up @@ -462,7 +468,7 @@ clk_div3 clk_normal // 4.77MHz
CHIPSET u_CHIPSET (
.clock (clk_cpu),
.clk_sys (CLK_50M),
.peripheral_clock (clk_4_77),
.peripheral_clock (peripheral_clock),

.reset (reset || splashscreen),
.cpu_address (cpu_address),
Expand Down
8 changes: 8 additions & 0 deletions README.md
Expand Up @@ -24,8 +24,16 @@ SN76489AN Compatible Implementation in VHDL Copyright (c) 2005, 2006, Arnim Laeu
* EMS
* Others...

* Turbo mode (7.16Mhz)

# ChangeLog

### Beta 0.7

* 4.77Mhz CPU clock with 33% duty cycle, thanks to @MicroCoreLabs
* Peripheral clock now works at half cpu clock, for correct synchronisation with the 8253 timer, thanks to @kitune-san
* Turbo option is disabled for the moment, requires a redesign of the BIU... for the to-do list

### Beta 0.6

* UART module implementation fix, thanks to @kitune-san
Expand Down
4 changes: 2 additions & 2 deletions SW/splash.txt
Expand Up @@ -5,7 +5,7 @@
(_()((_|(_|_)) (_(_())/((_|()\ (_)) )\_____((_)(_(_())
| \/ |(_) __||_ _(_)) ((_) | _ ((/ __\ \/ /|_ _|
| |\/| || \__ \ | | / -_)| '_| | _/| (__ > < | |
|_| |_||_|___/ |_| \___||_| |_| \___/_/\_\ |_| 06/06/2022
|_| |_||_|___/ |_| \___||_| |_| \___/_/\_\ |_| 07/06/2022


Port by @spark2k06, @naeloob
Expand All @@ -15,4 +15,4 @@
Contributors
------------

@JasonA, @gyurco, @kitune-san
@JasonA, @gyurco, @kitune-san, @MicroCoreLabs
Binary file added releases/PCXT_20220607.rbf
Binary file not shown.
4 changes: 2 additions & 2 deletions rtl/KFPC-XT/HDL/Peripherals.sv
Expand Up @@ -272,7 +272,7 @@ module PERIPHERALS #(
jtopl2 jtopl2_inst
(
.rst(reset),
.clk(peripheral_clock),
.clk(clock),
.cen(clk_en_opl2),
.din(internal_data_bus),
.dout(jtopl2_dout),
Expand All @@ -289,7 +289,7 @@ module PERIPHERALS #(
// Tandy sound
sn76489_top sn76489
(
.clock_i(peripheral_clock),
.clock_i(clock),
.clock_en_i(clk_en_opl2), // 3.579MHz
.res_n_i(reset),
.ce_n_i(tandy_chip_select_n),
Expand Down
29 changes: 20 additions & 9 deletions rtl/common/clk_div3.v
@@ -1,20 +1,31 @@
module clk_div3(clk, clk_out);

input clk;
output clk_out;
output reg clk_out;

reg [1:0] pos_count = 2'b00;
reg [1:0] neg_count = 2'b00;
wire [1:0] r_nxt;

always @(posedge clk)
if (pos_count ==2) pos_count <= 0;
else pos_count<= pos_count +1;
//always @(posedge clk)
//if (pos_count ==2) pos_count <= 0;
//else pos_count<= pos_count +1;

always @(negedge clk)
if (neg_count ==2) neg_count <= 0;
else neg_count<= neg_count +1;
//always @(negedge clk)
//if (neg_count ==2) neg_count <= 0;
//else neg_count<= neg_count +1;

assign clk_out = ((pos_count == 2) | (neg_count == 2));
//assign clk_out = ((pos_count == 2) | (neg_count == 2));

endmodule
always @(posedge clk) begin
if (pos_count ==2) begin
pos_count <= 0;
clk_out <= 1'b1;
end
else begin
pos_count<= pos_count +1;
clk_out <= 1'b0;
end
end

endmodule
2 changes: 1 addition & 1 deletion rtl/video/splash.hex

Large diffs are not rendered by default.

0 comments on commit 0d026a0

Please sign in to comment.