summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2022-09-04 18:09:38 -0600
committerAlejandro Soto <alejandro@34project.org>2022-09-04 18:09:38 -0600
commita9aafdf34ed44f115edf43f29a733eb82f366eb6 (patch)
tree0d17cf45300675a4a6bf5fc902ae2892ee7934aa
parentfa3610a57e89dd667075cd8922a07a69ec433fa0 (diff)
Add SDRAM test
-rw-r--r--conspiracion.qsf22
-rw-r--r--rtl/conspiracion.sv88
2 files changed, 91 insertions, 19 deletions
diff --git a/conspiracion.qsf b/conspiracion.qsf
index 0aa975f..b79614d 100644
--- a/conspiracion.qsf
+++ b/conspiracion.qsf
@@ -190,4 +190,26 @@ set_global_assignment -name USE_DLL_FREQUENCY_FOR_DQS_DELAY_CHAIN ON
set_global_assignment -name UNIPHY_SEQUENCER_DQS_CONFIG_ENABLE ON
set_global_assignment -name OPTIMIZE_MULTI_CORNER_TIMING ON
set_global_assignment -name ECO_REGENERATE_REPORT ON
+
+
+set_location_assignment PIN_AF14 -to clk_clk
+
+set_location_assignment PIN_AB12 -to dir
+
+set_location_assignment PIN_AA14 -to clr
+set_location_assignment PIN_AA15 -to mov
+set_location_assignment PIN_W15 -to add
+set_location_assignment PIN_Y16 -to io
+
+set_location_assignment PIN_V16 -to out[0]
+set_location_assignment PIN_W16 -to out[1]
+set_location_assignment PIN_V17 -to out[2]
+set_location_assignment PIN_V18 -to out[3]
+set_location_assignment PIN_W17 -to out[4]
+set_location_assignment PIN_W19 -to out[5]
+set_location_assignment PIN_Y19 -to out[6]
+set_location_assignment PIN_W20 -to out[7]
+set_location_assignment PIN_Y21 -to done
+
+
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top \ No newline at end of file
diff --git a/rtl/conspiracion.sv b/rtl/conspiracion.sv
index 96c6fb8..83e7d10 100644
--- a/rtl/conspiracion.sv
+++ b/rtl/conspiracion.sv
@@ -1,29 +1,41 @@
module conspiracion
(
- input wire clk_clk, // clk.clk
- output wire [12:0] memory_mem_a, // memory.mem_a
- output wire [2:0] memory_mem_ba, // .mem_ba
- output wire memory_mem_ck, // .mem_ck
- output wire memory_mem_ck_n, // .mem_ck_n
- output wire memory_mem_cke, // .mem_cke
- output wire memory_mem_cs_n, // .mem_cs_n
- output wire memory_mem_ras_n, // .mem_ras_n
- output wire memory_mem_cas_n, // .mem_cas_n
- output wire memory_mem_we_n, // .mem_we_n
- output wire memory_mem_reset_n, // .mem_reset_n
- inout wire [7:0] memory_mem_dq, // .mem_dq
- inout wire memory_mem_dqs, // .mem_dqs
- inout wire memory_mem_dqs_n, // .mem_dqs_n
- output wire memory_mem_odt, // .mem_odt
- output wire memory_mem_dm, // .mem_dm
- input wire memory_oct_rzqin, // .oct_rzqin
- input wire reset_reset_n // reset.reset_n
+ input wire clk_clk,
+ output wire [12:0] memory_mem_a,
+ output wire [2:0] memory_mem_ba,
+ output wire memory_mem_ck,
+ output wire memory_mem_ck_n,
+ output wire memory_mem_cke,
+ output wire memory_mem_cs_n,
+ output wire memory_mem_ras_n,
+ output wire memory_mem_cas_n,
+ output wire memory_mem_we_n,
+ output wire memory_mem_reset_n,
+ inout wire [7:0] memory_mem_dq,
+ inout wire memory_mem_dqs,
+ inout wire memory_mem_dqs_n,
+ output wire memory_mem_odt,
+ output wire memory_mem_dm,
+ input wire memory_oct_rzqin,
+ input wire reset_reset_n,
+
+ input logic dir, clr, mov, add, io,
+ output logic[7:0] out,
+ output logic done
);
+ enum {
+ IDLE,
+ IO,
+ RELEASE
+ } state;
+
logic[29:0] addr;
logic[31:0] data_rd, data_rw;
logic ready, write, start;
+ logic [7:0] leds;
+
platform plat
(
.master_0_core_addr(addr),
@@ -35,6 +47,44 @@ module conspiracion
.*
);
- initial start <= 0;
+ initial begin
+ addr <= 0;
+ start <= 0;
+ state <= IDLE;
+ done <= 0;
+ end
+
+ assign data_rw[7:0] = out;
+ assign write = dir;
+
+ always @(posedge clk_clk) unique case(state)
+ IDLE: begin
+ state <= RELEASE;
+
+ if(~clr)
+ out <= 0;
+ else if(~mov)
+ addr <= dir ? addr + 1 : addr - 1;
+ else if(~add)
+ out <= dir ? out + 1 : out - 1;
+ else if(~io) begin
+ start <= 1;
+ state <= IO;
+ end
+ end
+
+ IO: begin
+ done <= 1;
+ start <= 0;
+ if(ready) begin
+ if(~dir) out <= data_rd[7:0];
+ state <= RELEASE;
+ end
+ end
+ RELEASE: begin
+ done <= ~io;
+ if(clr & mov & add & io) state <= IDLE;
+ end
+ endcase
endmodule