summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--hdl/command_parser.sv2
-rw-r--r--hdl/ram_controller.sv22
-rw-r--r--hdl/top.sv4
-rw-r--r--tcl/init.tcl3
4 files changed, 17 insertions, 14 deletions
diff --git a/hdl/command_parser.sv b/hdl/command_parser.sv
index 39e03db..92abced 100644
--- a/hdl/command_parser.sv
+++ b/hdl/command_parser.sv
@@ -12,7 +12,7 @@ module command_parser
12 12
13 , input bit command_ready 13 , input bit command_ready
14 , output bit command_valid 14 , output bit command_valid
15 , output bit [23:0] command_address 15 , output bit [22:0] command_address
16 , output bit command_write 16 , output bit command_write
17 , output bit [15:0] command_data 17 , output bit [15:0] command_data
18 ); 18 );
diff --git a/hdl/ram_controller.sv b/hdl/ram_controller.sv
index 44d200b..d32560d 100644
--- a/hdl/ram_controller.sv
+++ b/hdl/ram_controller.sv
@@ -4,7 +4,7 @@ module ram_controller
4 4
5 , output bit command_ready 5 , output bit command_ready
6 , input bit command_valid 6 , input bit command_valid
7 , input bit [23:0] command_address 7 , input bit [22:0] command_address
8 , input bit command_write 8 , input bit command_write
9 , input bit [15:0] command_data 9 , input bit [15:0] command_data
10 10
@@ -13,7 +13,7 @@ module ram_controller
13 , output bit [15:0] result_data 13 , output bit [15:0] result_data
14 14
15 , output bit ram_resetn 15 , output bit ram_resetn
16 , output bit [1:0] ram_csn 16 , output bit ram_csn
17 , output bit ram_clkp 17 , output bit ram_clkp
18 , output bit ram_clkn 18 , output bit ram_clkn
19 , output bit ram_rwds_oe 19 , output bit ram_rwds_oe
@@ -27,7 +27,7 @@ module ram_controller
27 assign ram_clkn = !ram_clkp; 27 assign ram_clkn = !ram_clkp;
28 28
29 bit valid; 29 bit valid;
30 bit [23:0] address; 30 bit [22:0] address;
31 bit write; 31 bit write;
32 bit [15:0] data; 32 bit [15:0] data;
33 33
@@ -77,16 +77,22 @@ module ram_controller
77 , DATA_2 77 , DATA_2
78 } state; 78 } state;
79 79
80 (* syn_encoding = "compact" *) enum bit
81 { SETUP_OUTPUTS
82 , TOGGLE_CLOCK
83 } half_state;
84
80 bit [2:0] reset_counter; 85 bit [2:0] reset_counter;
81 86
87 bit prev_rwds;
88
82 always @(posedge clock) begin 89 always @(posedge clock) begin
83 if (!resetn || reset_counter != 0) begin 90 if (!resetn || reset_counter != 0) begin
84 command_ready = 0; 91 command_ready = 0;
85 result_valid = 0; 92 result_valid = 0;
86 result_data = 0; 93 result_data = 0;
87 ram_resetn = 0; 94 ram_resetn = 0;
88 ram_csn[0] = 1; 95 ram_csn = 1;
89 ram_csn[1] = 1;
90 ram_clkp = 0; 96 ram_clkp = 0;
91 ram_rwds_oe = 0; 97 ram_rwds_oe = 0;
92 ram_rwds_out = 0; 98 ram_rwds_out = 0;
@@ -117,8 +123,7 @@ module ram_controller
117 end 123 end
118 124
119 if (!valid) begin 125 if (!valid) begin
120 ram_csn[0] = 1; 126 ram_csn = 1;
121 ram_csn[1] = 1;
122 ram_clkp = 0; 127 ram_clkp = 0;
123 end else begin 128 end else begin
124 automatic bit stall = 0; 129 automatic bit stall = 0;
@@ -127,11 +132,10 @@ module ram_controller
127 132
128 CHIP_SELECT: begin 133 CHIP_SELECT: begin
129 ram_clkp = 0; // Overriding clock to guarantee that we're starting the command with the correct clock polarity 134 ram_clkp = 0; // Overriding clock to guarantee that we're starting the command with the correct clock polarity
130 ram_csn[address[23]] = 0; 135 ram_csn = 0;
131 end 136 end
132 137
133 SEND_COMMAND_1: begin 138 SEND_COMMAND_1: begin
134 ram_csn[address[23]] = 0;
135 ram_data_oe = 1; 139 ram_data_oe = 1;
136 ram_data_out = {!write, 1'b0, 1'b0, 5'b0}; // R/W#, ADDRSPACE, BURST, RESERVED 140 ram_data_out = {!write, 1'b0, 1'b0, 5'b0}; // R/W#, ADDRSPACE, BURST, RESERVED
137 end 141 end
diff --git a/hdl/top.sv b/hdl/top.sv
index 4fe4130..e170fe0 100644
--- a/hdl/top.sv
+++ b/hdl/top.sv
@@ -3,7 +3,7 @@ module top
3 , input bit resetn 3 , input bit resetn
4 4
5 , output bit ram_resetn 5 , output bit ram_resetn
6 , output bit [1:0] ram_csn 6 , output bit ram_csn
7 , output bit ram_clkp 7 , output bit ram_clkp
8 , output bit ram_clkn 8 , output bit ram_clkn
9 , inout bit ram_rwds 9 , inout bit ram_rwds
@@ -28,7 +28,7 @@ module top
28 28
29 bit command_ready; 29 bit command_ready;
30 bit command_valid; 30 bit command_valid;
31 bit [23:0] command_address; 31 bit [22:0] command_address;
32 bit command_write; 32 bit command_write;
33 bit [15:0] command_data; 33 bit [15:0] command_data;
34 34
diff --git a/tcl/init.tcl b/tcl/init.tcl
index c63734c..17e9c9e 100644
--- a/tcl/init.tcl
+++ b/tcl/init.tcl
@@ -72,8 +72,7 @@ rampin ram_data[4] T10
72rampin ram_data[5] R11 72rampin ram_data[5] R11
73rampin ram_data[6] R12 73rampin ram_data[6] R12
74rampin ram_data[7] R13 74rampin ram_data[7] R13
75rampin ram_csn[0] N12 75rampin ram_csn P9
76rampin ram_csn[1] P9
77rampin ram_rwds T14 76rampin ram_rwds T14
78rampin ram_clkp P14 77rampin ram_clkp P14
79rampin ram_clkn R14 78rampin ram_clkn R14