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