Updated Development Template
All files in the sys updated. Fixed bug in the fdc which makes drives write protected after a reset. Added early code for SDC LSN support.
This commit is contained in:
1 parent
935350fd4c
commit
e6f5e1821d
5 files changed
+168
-133
No files matched your search
+16
-40
@@ -90,7 +90,6 @@ module fdc(
|
||||
output [7:0] probe
|
||||
);
|
||||
|
||||
|
||||
wire [7:0] DRIVE_SEL_EXT;
|
||||
wire MOTOR;
|
||||
wire WRT_PREC;
|
||||
@@ -118,13 +117,17 @@ begin
|
||||
end
|
||||
end
|
||||
|
||||
localparam SDC_MAGIC_CMD = 4'd0;
|
||||
|
||||
wire [7:0] FF40_READ_VALUE = {HALT_EN, DRIVE_SEL_EXT[3], DENSITY, WRT_PREC, MOTOR, DRIVE_SEL_EXT[2:0]};
|
||||
wire SDC_EN = (FF40_READ_VALUE == SDC_MAGIC_CMD);
|
||||
wire [7:0] SDC_READ_DATA;
|
||||
|
||||
assign SDC_READ_DATA = 8'h00; // To be deleted.
|
||||
|
||||
//FDC read data path. =$ff40 or wd1793(s)
|
||||
assign DATA_HDD = (FF40_RD) ? {HALT_EN,
|
||||
DRIVE_SEL_EXT[3],
|
||||
DENSITY,
|
||||
WRT_PREC,
|
||||
MOTOR,
|
||||
DRIVE_SEL_EXT[2:0]}:
|
||||
assign DATA_HDD = (SDC_EN) ? SDC_READ_DATA:
|
||||
(FF40_RD) ? FF40_READ_VALUE:
|
||||
(WD1793_RD) ? DATA_1793: //(1793[s])
|
||||
8'h00;
|
||||
|
||||
@@ -384,69 +387,42 @@ reg [3:0] double_sided = 4'B0;
|
||||
// changing drives to the wd1793.
|
||||
// This can also get the disk size to properly handle DS drives - TBD
|
||||
|
||||
// Reset of drive wp to a default of 1 removed because of persistance.
|
||||
|
||||
// Drive 0
|
||||
|
||||
always @(negedge img_mounted[0] or negedge RESET_N)
|
||||
always @(negedge img_mounted[0])
|
||||
begin
|
||||
if (~RESET_N)
|
||||
begin
|
||||
drive_wp[0] <= 1'b1;
|
||||
end
|
||||
else
|
||||
begin
|
||||
drive_wp[0] <= img_readonly;
|
||||
drive_ready[0] <= 1'b1;
|
||||
double_sided[0]<= img_size > 20'd368600;//20'd368640;
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
// Drive 1
|
||||
|
||||
always @(negedge img_mounted[1] or negedge RESET_N)
|
||||
always @(negedge img_mounted[1])
|
||||
begin
|
||||
if (~RESET_N)
|
||||
begin
|
||||
drive_wp[1] <= 1'b1;
|
||||
end
|
||||
else
|
||||
begin
|
||||
drive_wp[1] <= img_readonly;
|
||||
drive_ready[1] <= 1'b1;
|
||||
double_sided[1]<= img_size > 20'd368600;//20'd368640;
|
||||
end
|
||||
end
|
||||
|
||||
// Drive 2
|
||||
|
||||
always @(negedge img_mounted[2] or negedge RESET_N)
|
||||
always @(negedge img_mounted[2])
|
||||
begin
|
||||
if (~RESET_N)
|
||||
begin
|
||||
drive_wp[2] <= 1'b1;
|
||||
end
|
||||
else
|
||||
begin
|
||||
drive_wp[2] <= img_readonly;
|
||||
drive_ready[2] <= 1'b1;
|
||||
double_sided[2]<= img_size > 20'd368600;//20'd368640;
|
||||
end
|
||||
end
|
||||
|
||||
// Drive 3
|
||||
|
||||
always @(negedge img_mounted[3] or negedge RESET_N)
|
||||
always @(negedge img_mounted[3])
|
||||
begin
|
||||
if (~RESET_N)
|
||||
begin
|
||||
drive_wp[3] <= 1'b1;
|
||||
end
|
||||
else
|
||||
begin
|
||||
drive_wp[3] <= img_readonly;
|
||||
drive_ready[3] <= 1'b1;
|
||||
//double_sided[3]<= img_size > 20'd368600;//20'd368640;
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
+109
-47
@@ -151,6 +151,7 @@ ENTITY ascal IS
|
||||
o_vs : OUT std_logic; -- V sync
|
||||
o_de : OUT std_logic; -- Display Enable
|
||||
o_vbl : OUT std_logic; -- V blank
|
||||
o_brd : OUT std_logic; -- border enable
|
||||
o_ce : IN std_logic; -- Clock Enable
|
||||
o_clk : IN std_logic; -- Output clock
|
||||
|
||||
@@ -458,6 +459,7 @@ ARCHITECTURE rtl OF ascal IS
|
||||
SIGNAL o_hacc,o_hacc_ini,o_hacc_next,o_vacc,o_vacc_next,o_vacc_ini : natural RANGE 0 TO 4*OHRES-1;
|
||||
SIGNAL o_hsv,o_vsv,o_dev,o_pev,o_end : unsigned(0 TO 5);
|
||||
SIGNAL o_hsp,o_vss : std_logic;
|
||||
SIGNAL o_vcarrym,o_prim : boolean;
|
||||
SIGNAL o_read,o_read_pre : std_logic;
|
||||
SIGNAL o_readlev,o_copylev : natural RANGE 0 TO 2;
|
||||
SIGNAL o_hburst,o_hbcpt : natural RANGE 0 TO 31;
|
||||
@@ -485,6 +487,7 @@ ARCHITECTURE rtl OF ascal IS
|
||||
SIGNAL o_divstart : std_logic;
|
||||
SIGNAL o_divrun : std_logic;
|
||||
SIGNAL o_hacpt,o_vacpt : unsigned(11 DOWNTO 0);
|
||||
SIGNAL o_vacptl : unsigned(1 DOWNTO 0);
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
FUNCTION shift_ishift(shift : unsigned(0 TO 119);
|
||||
@@ -705,8 +708,10 @@ ARCHITECTURE rtl OF ascal IS
|
||||
RETURN x;
|
||||
END FUNCTION;
|
||||
|
||||
SIGNAL o_h_frac2,o_v_frac : unsigned(FRAC-1 DOWNTO 0);
|
||||
SIGNAL o_h_near_frac,o_v_near_frac : unsigned(FRAC-1 DOWNTO 0);
|
||||
SIGNAL o_h_bil_frac,o_v_bil_frac : unsigned(FRAC-1 DOWNTO 0);
|
||||
SIGNAL o_h_bil_pix,o_v_bil_pix : type_pix;
|
||||
SIGNAL o_h_near_pix,o_v_near_pix : type_pix;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Nearest + Bilinear + Sharp Bilinear
|
||||
@@ -718,6 +723,7 @@ ARCHITECTURE rtl OF ascal IS
|
||||
TYPE type_bil_t IS RECORD
|
||||
r,g,b : unsigned(8+FRAC DOWNTO 0);
|
||||
END RECORD;
|
||||
|
||||
FUNCTION bil_calc(f : unsigned(FRAC-1 DOWNTO 0);
|
||||
p : arr_pix(0 TO 3)) RETURN type_bil_t IS
|
||||
VARIABLE fp,fn : unsigned(FRAC DOWNTO 0);
|
||||
@@ -725,7 +731,7 @@ ARCHITECTURE rtl OF ascal IS
|
||||
VARIABLE x : type_bil_t;
|
||||
CONSTANT Z : unsigned(FRAC-1 DOWNTO 0):=(OTHERS =>'0');
|
||||
BEGIN
|
||||
fp:='0' & f;
|
||||
fp:=('0' & f) + (Z & f(FRAC-1));
|
||||
fn:=('1' & Z) - fp;
|
||||
u:=p(2).r * fp + p(1).r * fn;
|
||||
x.r:=u;
|
||||
@@ -735,7 +741,27 @@ ARCHITECTURE rtl OF ascal IS
|
||||
x.b:=u;
|
||||
RETURN x;
|
||||
END FUNCTION;
|
||||
|
||||
FUNCTION near_calc(f : unsigned(FRAC-1 DOWNTO 0);
|
||||
p : arr_pix(0 TO 3)) RETURN type_bil_t IS
|
||||
VARIABLE fp,fn : unsigned(FRAC DOWNTO 0);
|
||||
VARIABLE u : unsigned(8+FRAC DOWNTO 0);
|
||||
VARIABLE x : type_bil_t;
|
||||
CONSTANT Z : unsigned(FRAC-1 DOWNTO 0):=(OTHERS =>'0');
|
||||
BEGIN
|
||||
IF f(FRAC-1)='0' THEN
|
||||
x.r := '0' & p(1).r & Z;
|
||||
x.g := '0' & p(1).g & Z;
|
||||
x.b := '0' & p(1).b & Z;
|
||||
ELSE
|
||||
x.r := '0' & p(2).r & Z;
|
||||
x.g := '0' & p(2).g & Z;
|
||||
x.b := '0' & p(2).b & Z;
|
||||
END IF;
|
||||
RETURN x;
|
||||
END FUNCTION;
|
||||
SIGNAL o_h_bil_t,o_v_bil_t : type_bil_t;
|
||||
SIGNAL o_h_near_t,o_v_near_t : type_bil_t;
|
||||
SIGNAL i_h_bil_t : type_bil_t;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
@@ -1864,36 +1890,52 @@ BEGIN
|
||||
o_state<=sHSYNC;
|
||||
o_hsp<='0';
|
||||
END IF;
|
||||
o_prim<=true;
|
||||
o_vcarrym<=false;
|
||||
|
||||
--------------------------------------------------
|
||||
WHEN sHSYNC =>
|
||||
dif_v:=(o_vacc_next - 2*o_vsize + 16384) MOD 16384;
|
||||
dif_v :=(o_vacc_next - 2*o_vsize + 16384) MOD 16384;
|
||||
IF o_prim THEN
|
||||
IF dif_v>=8192 THEN
|
||||
o_vacc <=o_vacc_next;
|
||||
ELSE
|
||||
o_vacc <=dif_v;
|
||||
END IF;
|
||||
END IF;
|
||||
IF dif_v>=8192 THEN
|
||||
o_vacc_next<=(o_vacc_next + 2*o_ivsize) MOD 8192;
|
||||
vcarry_v:=false;
|
||||
ELSE
|
||||
o_vacc <=dif_v;
|
||||
o_vacc_next<=(dif_v + 2*o_ivsize + 8192) MOD 8192;
|
||||
o_vacc_next<=dif_v;
|
||||
vcarry_v:=true;
|
||||
END IF;
|
||||
o_divstart<='1';
|
||||
|
||||
IF o_vcpt_pre2=o_vmin THEN
|
||||
o_vacc <=o_vacc_ini;
|
||||
o_vacc_next<=o_vacc_ini + 2*o_ivsize;
|
||||
o_vacpt<=x"001";
|
||||
o_vacpt <=x"001";
|
||||
o_vacptl<="01";
|
||||
vcarry_v:=false;
|
||||
END IF;
|
||||
|
||||
IF vcarry_v THEN
|
||||
o_vacpt<=o_vacpt+1;
|
||||
END IF;
|
||||
IF vcarry_v AND o_prim THEN
|
||||
o_vacptl<=o_vacptl+1;
|
||||
END IF;
|
||||
o_vcarrym <= o_vcarrym OR vcarry_v;
|
||||
o_prim <= false;
|
||||
o_hbcpt<=0; -- Clear burst counter on line
|
||||
IF (o_vpe='1' AND vcarry_v) OR o_fload>0 THEN
|
||||
o_divstart<=to_std_logic(NOT vcarry_v);
|
||||
IF NOT vcarry_v OR o_fload>0 THEN
|
||||
IF (o_vpe='1' AND o_vcarrym) OR o_fload>0 THEN
|
||||
o_state<=sREAD;
|
||||
ELSE
|
||||
o_state<=sDISP;
|
||||
END IF;
|
||||
END IF;
|
||||
|
||||
WHEN sREAD =>
|
||||
-- Read a block
|
||||
@@ -1942,7 +1984,7 @@ BEGIN
|
||||
o_alt<="0100";
|
||||
ELSE
|
||||
o_adrs<=to_unsigned(o_adrs_pre + (o_hbcpt * N_BURST),32);
|
||||
o_alt<=altx(o_vacpt(1 DOWNTO 0) + 1);
|
||||
o_alt<=altx(o_vacptl + 1);
|
||||
END IF;
|
||||
END IF;
|
||||
|
||||
@@ -2276,33 +2318,38 @@ BEGIN
|
||||
|
||||
o_hpixq<=(o_hpix3,o_hpix2,o_hpix1,o_hpix0);
|
||||
|
||||
-- NEAREST / BILINEAR / SHARP BILINEAR ---------------
|
||||
-- NEAREST -------------------------------------------
|
||||
-- C2
|
||||
o_h_near_frac<=near_frac(o_hfrac2);
|
||||
|
||||
-- C3
|
||||
o_h_near_t<=near_calc(o_h_near_frac,o_hpixq);
|
||||
|
||||
-- C4 : Nearest
|
||||
o_h_near_pix.r<=o_h_near_t.r(7+FRAC DOWNTO FRAC);
|
||||
o_h_near_pix.g<=o_h_near_t.g(7+FRAC DOWNTO FRAC);
|
||||
o_h_near_pix.b<=o_h_near_t.b(7+FRAC DOWNTO FRAC);
|
||||
|
||||
-- BILINEAR / SHARP BILINEAR ---------------
|
||||
-- C1 : Pre-calc Sharp Bilinear
|
||||
o_h_sbil_t<=sbil_frac1(o_hfrac1);
|
||||
|
||||
-- C2 : Select
|
||||
o_h_frac2<=(OTHERS =>'0');
|
||||
CASE o_hmode(1 DOWNTO 0) IS
|
||||
WHEN "00" => -- Nearest
|
||||
IF MASK(MASK_NEAREST)='1' THEN
|
||||
o_h_frac2<=near_frac(o_hfrac2);
|
||||
END IF;
|
||||
WHEN "01" => -- Bilinear
|
||||
o_h_bil_frac<=(OTHERS =>'0');
|
||||
IF o_hmode(0)='1' THEN -- Bilinear
|
||||
IF MASK(MASK_BILINEAR)='1' THEN
|
||||
o_h_frac2<=bil_frac(o_hfrac2);
|
||||
o_h_bil_frac<=bil_frac(o_hfrac2);
|
||||
END IF;
|
||||
WHEN "10" => -- Sharp Bilinear
|
||||
ELSE -- Sharp Bilinear
|
||||
IF MASK(MASK_SHARP_BILINEAR)='1' THEN
|
||||
o_h_frac2<=sbil_frac2(o_hfrac2,o_h_sbil_t);
|
||||
o_h_bil_frac<=sbil_frac2(o_hfrac2,o_h_sbil_t);
|
||||
END IF;
|
||||
END IF;
|
||||
WHEN OTHERS =>
|
||||
NULL;
|
||||
END CASE;
|
||||
|
||||
-- C3 : Opposite frac
|
||||
o_h_bil_t<=bil_calc(o_h_frac2,o_hpixq);
|
||||
o_h_bil_t<=bil_calc(o_h_bil_frac,o_hpixq);
|
||||
|
||||
-- C4 : Nearest / Bilinear / Sharp Bilinear
|
||||
-- C4 : Bilinear / Sharp Bilinear
|
||||
o_h_bil_pix.r<=bound(o_h_bil_t.r,8+FRAC);
|
||||
o_h_bil_pix.g<=bound(o_h_bil_t.g,8+FRAC);
|
||||
o_h_bil_pix.b<=bound(o_h_bil_t.b,8+FRAC);
|
||||
@@ -2340,9 +2387,12 @@ BEGIN
|
||||
o_ldw<=(x"00",x"00",x"00");
|
||||
|
||||
CASE o_hmode(2 DOWNTO 0) IS
|
||||
WHEN "000" | "001" | "010" => -- Nearest | Bilinear | Sharp Bilinear
|
||||
IF MASK(MASK_NEAREST)='1' OR
|
||||
MASK(MASK_BILINEAR)='1' OR
|
||||
WHEN "000" => -- Nearest
|
||||
IF MASK(MASK_NEAREST)='1' THEN
|
||||
o_ldw<=o_h_near_pix;
|
||||
END IF;
|
||||
WHEN "001" | "010" => -- Bilinear | Sharp Bilinear
|
||||
IF MASK(MASK_BILINEAR)='1' OR
|
||||
MASK(MASK_SHARP_BILINEAR)='1' THEN
|
||||
o_ldw<=o_h_bil_pix;
|
||||
END IF;
|
||||
@@ -2441,7 +2491,7 @@ BEGIN
|
||||
|
||||
-- CYCLE 2 -----------------------------------------
|
||||
-- Lines reordering
|
||||
CASE o_vacpt(1 DOWNTO 0) IS
|
||||
CASE o_vacptl IS
|
||||
WHEN "10" => pixq_v:=(o_ldr0,o_ldr1,o_ldr2,o_ldr3);
|
||||
WHEN "11" => pixq_v:=(o_ldr1,o_ldr2,o_ldr3,o_ldr0);
|
||||
WHEN "00" => pixq_v:=(o_ldr2,o_ldr3,o_ldr0,o_ldr1);
|
||||
@@ -2461,31 +2511,37 @@ BEGIN
|
||||
|
||||
o_vpixq1<=o_vpixq;
|
||||
|
||||
-- NEAREST / BILINEAR / SHARP BILINEAR -------------
|
||||
-- NEAREST -----------------------------------------
|
||||
-- C4
|
||||
o_v_near_frac<=near_frac(o_vfrac);
|
||||
|
||||
-- C5
|
||||
o_v_near_t<=near_calc(o_v_near_frac,o_vpixq1);
|
||||
|
||||
-- C6 : Nearest
|
||||
o_v_near_pix.r<=o_v_near_t.r(7+FRAC DOWNTO FRAC);
|
||||
o_v_near_pix.g<=o_v_near_t.g(7+FRAC DOWNTO FRAC);
|
||||
o_v_near_pix.b<=o_v_near_t.b(7+FRAC DOWNTO FRAC);
|
||||
|
||||
-- BILINEAR / SHARP BILINEAR -----------------------
|
||||
-- C3 : Pre-calc Sharp Bilinear
|
||||
o_v_sbil_t<=sbil_frac1(o_vfrac);
|
||||
|
||||
-- C4 : Select
|
||||
o_v_frac<=(OTHERS =>'0');
|
||||
CASE o_vmode(1 DOWNTO 0) IS
|
||||
WHEN "00" => -- Nearest
|
||||
IF MASK(MASK_NEAREST)='1' THEN
|
||||
o_v_frac<=near_frac(o_vfrac);
|
||||
END IF;
|
||||
WHEN "01" => -- Bilinear
|
||||
o_v_bil_frac<=(OTHERS =>'0');
|
||||
IF o_vmode(0)='1' THEN -- Bilinear
|
||||
IF MASK(MASK_BILINEAR)='1' THEN
|
||||
o_v_frac<=bil_frac(o_vfrac);
|
||||
o_v_bil_frac<=bil_frac(o_vfrac);
|
||||
END IF;
|
||||
WHEN "10" => -- Sharp Bilinear
|
||||
ELSE -- Sharp Bilinear
|
||||
IF MASK(MASK_SHARP_BILINEAR)='1' THEN
|
||||
o_v_frac<=sbil_frac2(o_vfrac,o_v_sbil_t);
|
||||
o_v_bil_frac<=sbil_frac2(o_vfrac,o_v_sbil_t);
|
||||
END IF;
|
||||
END IF;
|
||||
WHEN OTHERS => NULL;
|
||||
END CASE;
|
||||
|
||||
o_v_bil_t<=bil_calc(o_v_frac,o_vpixq1);
|
||||
o_v_bil_t<=bil_calc(o_v_bil_frac,o_vpixq1);
|
||||
|
||||
-- C6 : Nearest / Bilinear / Sharp Bilinear
|
||||
-- C6 : Bilinear / Sharp Bilinear
|
||||
o_v_bil_pix.r<=bound(o_v_bil_t.r,8+FRAC);
|
||||
o_v_bil_pix.g<=bound(o_v_bil_t.g,8+FRAC);
|
||||
o_v_bil_pix.b<=bound(o_v_bil_t.b,8+FRAC);
|
||||
@@ -2524,11 +2580,17 @@ BEGIN
|
||||
o_r<=x"00";
|
||||
o_g<=x"00";
|
||||
o_b<=x"00";
|
||||
o_brd<= not o_pev(5);
|
||||
|
||||
CASE o_vmode(2 DOWNTO 0) IS
|
||||
WHEN "000" | "001" | "010" => -- Nearest | Bilinear | Sharp Bilinear
|
||||
IF MASK(MASK_NEAREST)='1' OR
|
||||
MASK(MASK_BILINEAR)='1' OR
|
||||
WHEN "000" => -- Nearest
|
||||
IF MASK(MASK_NEAREST)='1' THEN
|
||||
o_r<=o_v_near_pix.r;
|
||||
o_g<=o_v_near_pix.g;
|
||||
o_b<=o_v_near_pix.b;
|
||||
END IF;
|
||||
WHEN "001" | "010" => -- Bilinear | Sharp Bilinear
|
||||
IF MASK(MASK_BILINEAR)='1' OR
|
||||
MASK(MASK_SHARP_BILINEAR)='1' THEN
|
||||
o_r<=o_v_bil_pix.r;
|
||||
o_g<=o_v_bil_pix.g;
|
||||
|
||||
+3
-3
@@ -24,13 +24,13 @@
|
||||
// Use buffer to access SD card. It's time-critical part.
|
||||
//
|
||||
// WIDE=1 for 16 bit file I/O
|
||||
// VDNUM 1..4
|
||||
// VDNUM 1..10
|
||||
// BLKSZ 0..7: 0 = 128, 1 = 256, 2 = 512(default), .. 7 = 16384
|
||||
//
|
||||
module hps_io #(parameter CONF_STR, CONF_STR_BRAM=1, PS2DIV=0, WIDE=0, VDNUM=1, BLKSZ=2, PS2WE=0)
|
||||
(
|
||||
input clk_sys,
|
||||
inout [45:0] HPS_BUS,
|
||||
inout [48:0] HPS_BUS,
|
||||
|
||||
// buttons up to 32
|
||||
output reg [31:0] joystick_0,
|
||||
@@ -316,7 +316,7 @@ always@(posedge clk_sys) begin : uio_block
|
||||
'h0X17,
|
||||
'h0X18: begin sd_ack <= disk[VD:0]; sdn_ack <= io_din[11:8]; end
|
||||
'h29: io_dout <= {4'hA, stflg};
|
||||
'h2B: io_dout <= 1;
|
||||
'h2B: io_dout <= {HPS_BUS[48:46],4'b0010};
|
||||
'h2F: io_dout <= 1;
|
||||
'h32: io_dout <= gamma_bus[21];
|
||||
'h36: begin io_dout <= info_n; info_n <= 0; end
|
||||
|
||||
+15
-6
@@ -9,6 +9,7 @@ module shadowmask
|
||||
input [23:0] din,
|
||||
input hs_in,vs_in,
|
||||
input de_in,
|
||||
input brd_in,
|
||||
input enable,
|
||||
|
||||
output reg [23:0] dout,
|
||||
@@ -32,10 +33,13 @@ always @(posedge clk) begin
|
||||
reg [3:0] vindex;
|
||||
reg [4:0] hmax2;
|
||||
reg [4:0] vmax2;
|
||||
reg old_hs, old_vs;
|
||||
reg [11:0] pcnt,pde;
|
||||
reg old_hs, old_vs, old_brd;
|
||||
reg next_v;
|
||||
|
||||
old_hs <= hs_in;
|
||||
old_vs <= vs_in;
|
||||
old_brd<= brd_in;
|
||||
|
||||
// hcount and vcount counts pixel rows and columns
|
||||
// hindex and vindex half the value of the counters for double size patterns
|
||||
@@ -49,13 +53,18 @@ always @(posedge clk) begin
|
||||
hmax2 <= ((mask_rotate ? vmax : hmax) << mask_2x) | mask_2x;
|
||||
vmax2 <= ((mask_rotate ? hmax : vmax) << mask_2x) | mask_2x;
|
||||
|
||||
hcount <= hcount + 1'b1;
|
||||
if (hcount == hmax2) hcount <= 0;
|
||||
pcnt <= pcnt+1'd1;
|
||||
if(old_brd && ~brd_in) pde <= pcnt-4'd3;
|
||||
|
||||
if((old_vs && ~vs_in)) vcount <= 0;
|
||||
hcount <= hcount+1'b1;
|
||||
if(hcount == hmax2 || pde == pcnt) hcount <= 0;
|
||||
|
||||
if(~old_brd && brd_in) next_v <= 1;
|
||||
if(old_vs && ~vs_in) vcount <= 0;
|
||||
if(old_hs && ~hs_in) begin
|
||||
vcount <= vcount + 1'b1;
|
||||
hcount <= 0;
|
||||
vcount <= vcount + next_v;
|
||||
next_v <= 0;
|
||||
pcnt <= 0;
|
||||
if (vcount == vmax2) vcount <= 0;
|
||||
end
|
||||
end
|
||||
|
||||
+25
-37
@@ -295,7 +295,7 @@ reg [31:0] cfg_custom_p2;
|
||||
reg [4:0] vol_att;
|
||||
initial vol_att = 5'b11111;
|
||||
|
||||
reg [6:0] coef_addr;
|
||||
reg [8:0] coef_addr;
|
||||
reg [8:0] coef_data;
|
||||
reg coef_wr = 0;
|
||||
|
||||
@@ -367,6 +367,7 @@ always@(posedge clk_sys) begin
|
||||
end
|
||||
end
|
||||
else begin
|
||||
cnt <= cnt + 1'd1;
|
||||
if(cmd == 1) begin
|
||||
cfg <= io_din;
|
||||
cfg_set <= 1;
|
||||
@@ -374,7 +375,6 @@ always@(posedge clk_sys) begin
|
||||
end
|
||||
if(cmd == 'h20) begin
|
||||
cfg_set <= 0;
|
||||
cnt <= cnt + 1'd1;
|
||||
if(cnt<8) begin
|
||||
case(cnt[2:0])
|
||||
0: if(WIDTH != io_din[11:0]) WIDTH <= io_din[11:0];
|
||||
@@ -406,7 +406,6 @@ always@(posedge clk_sys) begin
|
||||
end
|
||||
end
|
||||
if(cmd == 'h2F) begin
|
||||
cnt <= cnt + 1'd1;
|
||||
case(cnt[3:0])
|
||||
0: {LFB_EN,LFB_FLT,LFB_FMT} <= {io_din[15], io_din[14], io_din[5:0]};
|
||||
1: LFB_BASE[15:0] <= io_din[15:0];
|
||||
@@ -423,12 +422,14 @@ always@(posedge clk_sys) begin
|
||||
if(cmd == 'h25) {led_overtake, led_state} <= io_din;
|
||||
if(cmd == 'h26) vol_att <= io_din[4:0];
|
||||
if(cmd == 'h27) VSET <= io_din[11:0];
|
||||
if(cmd == 'h2A) {coef_wr,coef_addr,coef_data} <= {1'b1,io_din};
|
||||
if(cmd == 'h2A) begin
|
||||
if(cnt[0]) {coef_wr,coef_data} <= {1'b1,io_din[8:0]};
|
||||
else coef_addr <= io_din[8:0];
|
||||
end
|
||||
if(cmd == 'h2B) scaler_flt <= io_din[2:0];
|
||||
if(cmd == 'h37) {FREESCALE,HSET} <= {io_din[15],io_din[11:0]};
|
||||
if(cmd == 'h38) vs_line <= io_din[11:0];
|
||||
if(cmd == 'h39) begin
|
||||
cnt <= cnt + 1'd1;
|
||||
case(cnt[3:0])
|
||||
0: acx_att <= io_din[4:0];
|
||||
1: aflt_rate[15:0] <= io_din;
|
||||
@@ -448,7 +449,6 @@ always@(posedge clk_sys) begin
|
||||
endcase
|
||||
end
|
||||
if(cmd == 'h3A) begin
|
||||
cnt <= cnt + 1'd1;
|
||||
case(cnt[3:0])
|
||||
0: arc1x <= io_din[12:0];
|
||||
1: arc1y <= io_din[12:0];
|
||||
@@ -456,7 +456,6 @@ always@(posedge clk_sys) begin
|
||||
3: arc2y <= io_din[12:0];
|
||||
endcase
|
||||
end
|
||||
|
||||
`ifndef MISTER_DEBUG_NOHDMI
|
||||
if(cmd == 'h3E) {shadowmask_wr,shadowmask_data} <= {1'b1, io_din};
|
||||
`endif
|
||||
@@ -626,7 +625,7 @@ wire [15:0] vbuf_byteenable;
|
||||
wire vbuf_write;
|
||||
|
||||
wire [23:0] hdmi_data;
|
||||
wire hdmi_vs, hdmi_hs, hdmi_de, hdmi_vbl;
|
||||
wire hdmi_vs, hdmi_hs, hdmi_de, hdmi_vbl, hdmi_brd;
|
||||
wire freeze;
|
||||
|
||||
`ifndef MISTER_DEBUG_NOHDMI
|
||||
@@ -642,6 +641,7 @@ ascal
|
||||
.PALETTE2("false"),
|
||||
`endif
|
||||
`endif
|
||||
.FRAC(6),
|
||||
.N_DW(128),
|
||||
.N_AW(28)
|
||||
)
|
||||
@@ -675,6 +675,7 @@ ascal
|
||||
.o_vs (hdmi_vs),
|
||||
.o_de (hdmi_de),
|
||||
.o_vbl (hdmi_vbl),
|
||||
.o_brd (hdmi_brd),
|
||||
.o_lltune (lltune),
|
||||
.htotal (WIDTH + HFP + HBP + HS),
|
||||
.hsstart (WIDTH + HFP),
|
||||
@@ -1057,8 +1058,6 @@ cyclonev_hps_interface_peripheral_i2c hdmi_i2c
|
||||
);
|
||||
|
||||
`ifndef MISTER_DEBUG_NOHDMI
|
||||
wire [23:0] hdmi_data_sl;
|
||||
wire hdmi_de_sl, hdmi_vs_sl, hdmi_hs_sl;
|
||||
|
||||
`ifdef MISTER_FB
|
||||
reg dis_output;
|
||||
@@ -1071,22 +1070,6 @@ end
|
||||
wire dis_output = 0;
|
||||
`endif
|
||||
|
||||
scanlines #(1) HDMI_scanlines
|
||||
(
|
||||
.clk(clk_hdmi),
|
||||
|
||||
.scanlines(LFB_EN ? 2'b00 : scanlines),
|
||||
.din(dis_output ? 24'd0 : hdmi_data),
|
||||
.hs_in(hdmi_hs),
|
||||
.vs_in(hdmi_vs),
|
||||
.de_in(hdmi_de),
|
||||
|
||||
.dout(hdmi_data_sl),
|
||||
.hs_out(hdmi_hs_sl),
|
||||
.vs_out(hdmi_vs_sl),
|
||||
.de_out(hdmi_de_sl)
|
||||
);
|
||||
|
||||
wire [23:0] hdmi_data_mask;
|
||||
wire hdmi_de_mask, hdmi_vs_mask, hdmi_hs_mask;
|
||||
|
||||
@@ -1101,10 +1084,11 @@ shadowmask HDMI_shadowmask
|
||||
.cmd_wr(shadowmask_wr),
|
||||
.cmd_in(shadowmask_data),
|
||||
|
||||
.din(hdmi_data_sl),
|
||||
.hs_in(hdmi_hs_sl),
|
||||
.vs_in(hdmi_vs_sl),
|
||||
.de_in(hdmi_de_sl),
|
||||
.din(dis_output ? 24'd0 : hdmi_data),
|
||||
.hs_in(hdmi_hs),
|
||||
.vs_in(hdmi_vs),
|
||||
.de_in(hdmi_de),
|
||||
.brd_in(hdmi_brd),
|
||||
.enable(~LFB_EN),
|
||||
|
||||
.dout(hdmi_data_mask),
|
||||
@@ -1496,12 +1480,12 @@ wire [6:0] user_out, user_in;
|
||||
|
||||
assign clk_ihdmi= clk_vid;
|
||||
assign ce_hpix = ce_pix;
|
||||
assign hr_out = r_out;
|
||||
assign hg_out = g_out;
|
||||
assign hb_out = b_out;
|
||||
assign hhs_fix = hs_fix;
|
||||
assign hvs_fix = vs_fix;
|
||||
assign hde_emu = de_emu;
|
||||
assign hr_out = vga_data_sl[23:16];
|
||||
assign hg_out = vga_data_sl[15:8];
|
||||
assign hb_out = vga_data_sl[7:0];
|
||||
assign hhs_fix = vga_hs_sl;
|
||||
assign hvs_fix = vga_vs_sl;
|
||||
assign hde_emu = vga_de_sl;
|
||||
|
||||
wire uart_dtr;
|
||||
wire uart_dsr;
|
||||
@@ -1538,11 +1522,15 @@ wire [13:0] fb_stride;
|
||||
assign fb_stride = 0;
|
||||
`endif
|
||||
|
||||
reg [1:0] sl_r;
|
||||
wire [1:0] sl = sl_r;
|
||||
always @(posedge clk_sys) sl_r <= FB_EN ? 2'b00 : scanlines;
|
||||
|
||||
emu emu
|
||||
(
|
||||
.CLK_50M(FPGA_CLK2_50),
|
||||
.RESET(reset),
|
||||
.HPS_BUS({f1, HDMI_TX_VS,
|
||||
.HPS_BUS({fb_en, sl, f1, HDMI_TX_VS,
|
||||
clk_100m, clk_ihdmi,
|
||||
ce_hpix, hde_emu, hhs_fix, hvs_fix,
|
||||
io_wait, clk_sys, io_fpga, io_uio, io_strobe, io_wide, io_din, io_dout}),
|
||||
|
||||
Reference in new issue
Block a user