Skip to content
Snippets Groups Projects
Commit d44d3db7 authored by ks6n19's avatar ks6n19
Browse files

Update behavioural/ahb_out.sv, behavioural/arm_soc.sv, behavioural/de1_soc_wrapper.sv files

parent e850ea3d
No related branches found
No related tags found
No related merge requests found
...@@ -43,14 +43,13 @@ module ahb_out( ...@@ -43,14 +43,13 @@ module ahb_out(
//Non-AHB signals //Non-AHB signals
input logic [9:0] pixel_x , input logic [9:0] pixel_x ,
input logic [8:0] pixel_y , input logic [8:0] pixel_y ,
input logic [10:0] x1, x2, y1, y2, x3, y3,
// AHB Signals from Slave to Master // AHB Signals from Slave to Master
output logic [31:0] HRDATA, output logic [31:0] HRDATA,
output HREADYOUT, output HREADYOUT,
//Non-AHB Signals //Non-AHB Signals
output logic pixel output logic pixel,
output logic [10:0] x1, x2, y1, y2, x3, y3
); );
timeunit 1ns; timeunit 1ns;
...@@ -62,12 +61,15 @@ timeprecision 100ps; ...@@ -62,12 +61,15 @@ timeprecision 100ps;
//control signals are stored in registers //control signals are stored in registers
logic write_enable, read_enable; logic write_enable, read_enable;
logic [2:0] word_address ; logic [2:0] word_address ;
logic [18:0] word_address_memory;
logic [18:0] pixel_address ;
//memory //memory
logic [0:0] memory [0:307199] ; logic [0:0] memory [0:307199] ;
logic [18:0] memory_address;
logic [18:0] pixel_address ;
logic [10:0] x,y ;
// Unused registers
logic NextDataValid; logic NextDataValid;
logic [15:0] Status; logic [15:0] Status;
...@@ -78,15 +80,12 @@ timeprecision 100ps; ...@@ -78,15 +80,12 @@ timeprecision 100ps;
write_enable <= '0; write_enable <= '0;
read_enable <= '0; read_enable <= '0;
word_address <= '0; word_address <= '0;
word_address_memory <= '0;
end end
else if ( HREADY && HSEL && (HTRANS != No_Transfer) ) else if ( HREADY && HSEL && (HTRANS != No_Transfer) )
begin begin
write_enable <= HWRITE; write_enable <= HWRITE;
read_enable <= ! HWRITE; read_enable <= ! HWRITE;
word_address <= HADDR[4:2]; word_address <= HADDR[4:2];
word_address_memory <= HADDR[23:5] ;
end end
else else
...@@ -94,42 +93,40 @@ timeprecision 100ps; ...@@ -94,42 +93,40 @@ timeprecision 100ps;
write_enable <= '0; write_enable <= '0;
read_enable <= '0; read_enable <= '0;
word_address <= '0; word_address <= '0;
word_address_memory <= '0;
end end
//Act on control signals in the data phase // Act on control signals in the data phase
// Write pixel coordinates
// write
always_ff @(posedge HCLK, negedge HRESETn) always_ff @(posedge HCLK, negedge HRESETn)
if ( ! HRESETn ) if ( ! HRESETn )
begin begin
x1 <= '0; x1 <= '0;
x2 <= '0; x2 <= '0;
x3 <= '0; x3 <= '0;
y1 <= '0; y1 <= '0;
y2 <= '0; y2 <= '0;
y3 <= '0; y3 <= '0;
end end
// x1 write // x1 write
else if ( write_enable && (word_address==0)) else if ( write_enable && (word_address==0))
x1 <= HWDATA[15:0]; x1 <= HWDATA;
// y1 write // y1 write
else if ( write_enable && (word_address==1)) else if ( write_enable && (word_address==1))
y1 <= HWDATA[15:0]; y1 <= HWDATA;
// x2 write // x2 write
else if ( write_enable && (word_address==2)) else if ( write_enable && (word_address==2))
x2 <= HWDATA[15:0]; x2 <= HWDATA;
// y2 write // y2 write
else if ( write_enable && (word_address==3)) else if ( write_enable && (word_address==3))
y2 <= HWDATA[15:0]; y2 <= HWDATA;
// x3 write // x3 write
else if ( write_enable && (word_address==4)) else if ( write_enable && (word_address==4))
x3 <= HWDATA[15:0]; x3 <= HWDATA;
// y3 write // y3 write
else if ( write_enable && (word_address==5)) else if ( write_enable && (word_address==5))
...@@ -143,20 +140,60 @@ memory = '{307200{0}}; ...@@ -143,20 +140,60 @@ memory = '{307200{0}};
always_ff @(posedge HCLK) always_ff @(posedge HCLK)
begin begin
if( write_enable ) if( write_enable )
memory[word_address_memory] <= HWDATA ; memory[memory_address] <= x + (640*y) ;
end end
always_comb always_comb
pixel_address = (pixel_y * 640) + pixel_x ; pixel_address = (pixel_y * 640) + pixel_x ;
always_ff @(posedge HCLK) always_ff @(posedge HCLK)
begin begin
pixel <= memory[pixel_address] ; pixel <= memory[pixel_address] ;
end end
// memory_address increments from 0 to 307199
always_ff @(posedge HCLK)
begin
if( !HRESETn )
memory_address <= '0;
else if(memory_address >= 307200)
memory_address <= '0;
else
memory_address <= memory_address + 1 ;
end
// x increments from 0 to 639
always_ff @(posedge HCLK)
begin
if( !HRESETn )
x <= '0;
else if(x >= 639)
x <= '0;
else
x <= x + 1 ;
end
// y increments from 0 to 479
always_ff @(posedge HCLK)
begin
if( !HRESETn )
y <= '0;
else if(y >= 479)
y <= '0;
else
y <= y + 1 ;
end
// Read not allowed // Read not allowed
assign HRDATA = '0; // read is not permitted mode assign HRDATA = '0; // read is not permitted mode
......
...@@ -6,10 +6,10 @@ module arm_soc( ...@@ -6,10 +6,10 @@ module arm_soc(
input HCLK, HRESETn, input HCLK, HRESETn,
input logic [9:0] pixel_x , input logic [9:0] pixel_x ,
input logic [8:0] pixel_y, input logic [8:0] pixel_y,
input logic [10:0] x1, x2, y1, y2, x3, y3,
input [15:0] Switches, input [15:0] Switches,
input [1:0] Buttons, input [1:0] Buttons,
output logic pixel, output logic pixel,
output logic [10:0] x1, x2, y1, y2, x3, y3,
output LOCKUP output LOCKUP
); );
...@@ -94,7 +94,7 @@ timeprecision 100ps; ...@@ -94,7 +94,7 @@ timeprecision 100ps;
.HSEL(HSEL_DOUT), .HSEL(HSEL_DOUT),
.HRDATA(HRDATA_DOUT), .HREADYOUT(HREADYOUT_DOUT), .HRDATA(HRDATA_DOUT), .HREADYOUT(HREADYOUT_DOUT),
.x1(x1), .x2(x2), .y1(y1), .y2(y2), .x3(x3), .y3(y3) .pixel_x(pixel_x), .pixel_y(pixel_y) , .pixel(pixel) .x1(x1), .x2(x2), .y1(y1), .y2(y2), .x3(x3), .y3(y3), .pixel_x(pixel_x), .pixel_y(pixel_y) , .pixel(pixel)
); );
......
...@@ -35,11 +35,12 @@ timeprecision 100ps; ...@@ -35,11 +35,12 @@ timeprecision 100ps;
logic pixel ; logic pixel ;
logic [9:0] pixel_x ; logic [9:0] pixel_x ;
logic [8:0] pixel_y ; logic [8:0] pixel_y ;
logic [10:0] x1,y1,x2,y2,x3,y3 ;
assign Switches = { 6'd0, SW }; // DE1-SoC has just 10 switches assign Switches = { 6'd0, SW }; // DE1-SoC has just 10 switches
assign Buttons = ~KEY[1:0]; assign Buttons = ~KEY[1:0];
arm_soc soc_inst(.HCLK, .HRESETn, .Switches, .pixel(pixel), .pixel_x(pixel_x), .pixel_y(pixel_y), .Buttons, .LOCKUP); arm_soc soc_inst(.HCLK, .HRESETn, .Switches, .pixel(pixel), .pixel_x(pixel_x), .pixel_y(pixel_y), .x1(x1), .y1(y1), .x2(x2), .y2(y2), .x3(x3), .y3(y3), .Buttons, .LOCKUP);
razzle raz_inst ( razzle raz_inst (
.CLOCK_50(CLOCK_50), .KEY(KEY), .pixel_x(pixel_x), .pixel_y(pixel_y), .pixel(pixel), .CLOCK_50(CLOCK_50), .KEY(KEY), .pixel_x(pixel_x), .pixel_y(pixel_y), .pixel(pixel),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment