Skip to content

Commit 07dafda

Browse files
authored
Merge pull request #1068 from slaclab/ESCORE-782
adding more RST_ASYNC_G support
2 parents c525be3 + 19775fe commit 07dafda

File tree

151 files changed

+1170
-832
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+1170
-832
lines changed

axi/axi-lite/rtl/AxiDualPortRam.vhd

+15-6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use surf.AxiLitePkg.all;
2525
entity AxiDualPortRam is
2626
generic (
2727
TPD_G : time := 1 ns;
28+
RST_ASYNC_G : boolean := false;
2829
SYNTH_MODE_G : string := "inferred";
2930
MEMORY_TYPE_G : string := "block";
3031
MEMORY_INIT_FILE_G : string := "none"; -- Used for MEMORY_TYPE_G="XPM only
@@ -201,6 +202,7 @@ begin
201202
DualPortRam_1 : entity surf.DualPortRam
202203
generic map (
203204
TPD_G => TPD_G,
205+
RST_ASYNC_G => RST_ASYNC_G,
204206
MEMORY_TYPE_G => MEMORY_TYPE_G,
205207
REG_EN_G => ite(READ_LATENCY_G >= 1, true, false),
206208
DOA_REG_G => ite(READ_LATENCY_G >= 2, true, false),
@@ -232,6 +234,7 @@ begin
232234
DualPortRam_1 : entity surf.DualPortRam
233235
generic map (
234236
TPD_G => TPD_G,
237+
RST_ASYNC_G => RST_ASYNC_G,
235238
MEMORY_TYPE_G => MEMORY_TYPE_G,
236239
REG_EN_G => ite(READ_LATENCY_G >= 1, true, false),
237240
DOA_REG_G => ite(READ_LATENCY_G >= 2, true, false),
@@ -261,6 +264,7 @@ begin
261264
U_TrueDualPortRam_1 : entity surf.TrueDualPortRam
262265
generic map (
263266
TPD_G => TPD_G,
267+
RST_ASYNC_G => RST_ASYNC_G,
264268
BYTE_WR_EN_G => true,
265269
DOA_REG_G => ite(READ_LATENCY_G >= 2, true, false),
266270
DOB_REG_G => ite(READ_LATENCY_G >= 2, true, false),
@@ -301,6 +305,7 @@ begin
301305
U_SynchronizerFifo_1 : entity surf.SynchronizerFifo
302306
generic map (
303307
TPD_G => TPD_G,
308+
RST_ASYNC_G => RST_ASYNC_G,
304309
COMMON_CLK_G => COMMON_CLK_G,
305310
MEMORY_TYPE_G => "distributed",
306311
DATA_WIDTH_G => ADDR_WIDTH_G+DATA_WIDTH_G+ADDR_AXI_BYTES_C)
@@ -387,7 +392,7 @@ begin
387392
end case;
388393

389394
-- Reset
390-
if (axiRst = '1') then
395+
if (RST_ASYNC_G = false and axiRst = '1') then
391396
v := REG_INIT_C;
392397
end if;
393398

@@ -400,18 +405,22 @@ begin
400405

401406
end process comb;
402407

403-
seq : process (axiClk) is
408+
seq : process (axiClk, axiRst) is
404409
begin
405-
if (rising_edge(axiClk)) then
410+
if (RST_ASYNC_G and axiRst = '1') then
411+
r <= REG_INIT_C after TPD_G;
412+
elsif rising_edge(axiClk) then
406413
r <= rin after TPD_G;
407414
end if;
408415
end process seq;
409416

410417
OUT_REG : if((READ_LATENCY_G = 3) and (SYNTH_MODE_G /= "xpm")) generate
411-
REG : process (clk) is
418+
REG : process (clk, rst) is
412419
begin
413-
if(rising_edge(clk)) then
414-
if (rst = '1') then
420+
if (RST_ASYNC_G and rst = '1') then
421+
dout <= (others => '0');
422+
elsif (rising_edge(clk)) then
423+
if (RST_ASYNC_G = false and rst = '1') then
415424
dout <= (others => '0');
416425
else
417426
dout <= doutInt;

axi/axi-lite/rtl/AxiLiteAsync.vhd

+9-10
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ use ieee.std_logic_1164.all;
1919
use ieee.std_logic_arith.all;
2020
use ieee.std_logic_unsigned.all;
2121

22-
2322
library surf;
2423
use surf.StdRtlPkg.all;
2524
use surf.AxiLitePkg.all;
2625

2726
entity AxiLiteAsync is
2827
generic (
2928
TPD_G : time := 1 ns;
29+
RST_ASYNC_G : boolean := false;
3030
AXI_ERROR_RESP_G : slv(1 downto 0) := AXI_RESP_SLVERR_C;
31-
COMMON_CLK_G : boolean := false;
32-
NUM_ADDR_BITS_G : natural := 32;
33-
PIPE_STAGES_G : integer range 0 to 16 := 0);
31+
COMMON_CLK_G : boolean := false;
32+
NUM_ADDR_BITS_G : natural := 32;
33+
PIPE_STAGES_G : integer range 0 to 16 := 0);
3434
port (
3535
-- Slave Port
3636
sAxiClk : in sl;
@@ -120,8 +120,6 @@ begin
120120
asyncRst => mAxiClkRst,
121121
syncRst => m2sRst);
122122

123-
124-
125123
------------------------------------
126124
-- Read: Slave to Master
127125
------------------------------------
@@ -130,6 +128,7 @@ begin
130128
U_ReadSlaveToMastFifo : entity surf.FifoASync
131129
generic map (
132130
TPD_G => TPD_G,
131+
RST_ASYNC_G => RST_ASYNC_G,
133132
RST_POLARITY_G => '1',
134133
MEMORY_TYPE_G => "distributed", -- Use Dist Ram
135134
FWFT_EN_G => true,
@@ -184,7 +183,6 @@ begin
184183
mAxiReadMaster.arvalid <= readSlaveToMastValid;
185184
readSlaveToMastRead <= mAxiReadSlave.arready;
186185

187-
188186
------------------------------------
189187
-- Read: Master To Slave
190188
------------------------------------
@@ -193,6 +191,7 @@ begin
193191
U_ReadMastToSlaveFifo : entity surf.FifoASync
194192
generic map (
195193
TPD_G => TPD_G,
194+
RST_ASYNC_G => RST_ASYNC_G,
196195
RST_POLARITY_G => '1',
197196
MEMORY_TYPE_G => "distributed", -- Use Dist Ram
198197
FWFT_EN_G => true,
@@ -242,7 +241,6 @@ begin
242241
sAxiReadSlave.rvalid <= ite(m2sRst = '0', readMastToSlaveValid, '1');
243242
readMastToSlaveRead <= sAxiReadMaster.rready;
244243

245-
246244
------------------------------------
247245
-- Write Addr : Slave To Master
248246
------------------------------------
@@ -251,6 +249,7 @@ begin
251249
U_WriteAddrSlaveToMastFifo : entity surf.FifoASync
252250
generic map (
253251
TPD_G => TPD_G,
252+
RST_ASYNC_G => RST_ASYNC_G,
254253
RST_POLARITY_G => '1',
255254
MEMORY_TYPE_G => "distributed", -- Use Dist Ram
256255
FWFT_EN_G => true,
@@ -305,7 +304,6 @@ begin
305304
mAxiWriteMaster.awvalid <= writeAddrSlaveToMastValid;
306305
writeAddrSlaveToMastRead <= mAxiWriteSlave.awready;
307306

308-
309307
------------------------------------
310308
-- Write Data : Slave to Master
311309
------------------------------------
@@ -314,6 +312,7 @@ begin
314312
U_WriteDataSlaveToMastFifo : entity surf.FifoASync
315313
generic map (
316314
TPD_G => TPD_G,
315+
RST_ASYNC_G => RST_ASYNC_G,
317316
RST_POLARITY_G => '1',
318317
MEMORY_TYPE_G => "distributed", -- Use Dist Ram
319318
FWFT_EN_G => true,
@@ -363,7 +362,6 @@ begin
363362
mAxiWriteMaster.wvalid <= writeDataSlaveToMastValid;
364363
writeDataSlaveToMastRead <= mAxiWriteSlave.wready;
365364

366-
367365
------------------------------------
368366
-- Write: Status Master To Slave
369367
------------------------------------
@@ -372,6 +370,7 @@ begin
372370
U_WriteMastToSlaveFifo : entity surf.FifoASync
373371
generic map (
374372
TPD_G => TPD_G,
373+
RST_ASYNC_G => RST_ASYNC_G,
375374
RST_POLARITY_G => '1',
376375
MEMORY_TYPE_G => "distributed", -- Use Dist Ram
377376
FWFT_EN_G => true,

axi/axi-lite/rtl/AxiLiteCrossbar.vhd

+4-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use surf.ArbiterPkg.all;
2424
use surf.TextUtilPkg.all;
2525

2626
entity AxiLiteCrossbar is
27-
2827
generic (
2928
TPD_G : time := 1 ns;
3029
RST_ASYNC_G : boolean := false;
@@ -175,7 +174,7 @@ begin
175174
case (r.slave(s).wrState) is
176175
when S_WAIT_AXI_TXN_S =>
177176

178-
-- Incomming write
177+
-- Incoming write
179178
if (sAxiWriteMasters(s).awvalid = '1' and sAxiWriteMasters(s).wvalid = '1') then
180179

181180
for m in MASTERS_CONFIG_G'range loop
@@ -248,7 +247,7 @@ begin
248247
case (r.slave(s).rdState) is
249248
when S_WAIT_AXI_TXN_S =>
250249

251-
-- Incomming read
250+
-- Incoming read
252251
if (sAxiReadMasters(s).arvalid = '1') then
253252
for m in MASTERS_CONFIG_G'range loop
254253
-- Check for address match
@@ -340,7 +339,7 @@ begin
340339
end if;
341340

342341
-- Upon valid request (set 1 cycle previous by arbitrate()), connect slave side
343-
-- busses to this master's outputs.
342+
-- buses to this master's outputs.
344343
if (r.master(m).wrValid = '1') then
345344
v.master(m).wrAcks := r.master(m).wrAcks;
346345
v.mAxiWriteMasters(m) := sAxiWriteMasters(conv_integer(r.master(m).wrAckNum));
@@ -397,7 +396,7 @@ begin
397396
end if;
398397

399398
-- Upon valid request (set 1 cycle previous by arbitrate()), connect slave side
400-
-- busses to this master's outputs.
399+
-- buses to this master's outputs.
401400
if (r.master(m).rdValid = '1') then
402401
v.master(m).rdAcks := r.master(m).rdAcks;
403402
v.mAxiReadMasters(m) := sAxiReadMasters(conv_integer(r.master(m).rdAckNum));

axi/axi-lite/rtl/AxiLiteFifoPop.vhd

+22-27
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
-- Supports reading of general purpose FIFOs from the AxiLite bus.
66
-- One address location per FIFO.
77
-- Address map depends on the POP and LOOP FIFO counts.
8-
-- RANGE_LSB_G sets the address bit which seperates the
8+
-- RANGE_LSB_G sets the address bit which separates the
99
-- POP FIFO address space from the loop FIFO address space.
1010
-- RANGE_LSB_G must be large enough for the number of POP and LOOP FIFOs
1111
-- enabled. I.E. if POP_FIFO_COUNT_C is 8, RANGE_FIFO_G must be > 5.
12-
-- POP Fifos exist at 0x0, 0x4, 0x8, 0xC ...
13-
-- LOOP Fifos exist at 2^(RANGE_LSB_C) + 0x0, + 0x4, etc.
12+
-- POP FIFOs exist at 0x0, 0x4, 0x8, 0xC ...
13+
-- LOOP FIFOs exist at 2^(RANGE_LSB_C) + 0x0, + 0x4, etc.
1414
-------------------------------------------------------------------------------
1515
-- This file is part of 'SLAC Firmware Standard Library'.
1616
-- It is subject to the license terms in the LICENSE.txt file found in the
@@ -23,9 +23,8 @@
2323

2424
library ieee;
2525
use ieee.std_logic_1164.all;
26-
use IEEE.STD_LOGIC_ARITH.ALL;
27-
use IEEE.STD_LOGIC_UNSIGNED.ALL;
28-
26+
use ieee.std_logic_arith.all;
27+
use ieee.std_logic_unsigned.all;
2928

3029
library surf;
3130
use surf.StdRtlPkg.all;
@@ -34,6 +33,7 @@ use surf.AxiLitePkg.all;
3433
entity AxiLiteFifoPop is
3534
generic (
3635
TPD_G : time := 1 ns;
36+
RST_ASYNC_G : boolean := false;
3737
POP_FIFO_COUNT_G : positive := 1;
3838
POP_SYNC_FIFO_G : boolean := false;
3939
POP_MEMORY_TYPE_G : string := "block";
@@ -45,10 +45,8 @@ entity AxiLiteFifoPop is
4545
LOOP_ADDR_WIDTH_G : integer range 4 to 48 := 4;
4646
RANGE_LSB_G : integer range 0 to 31 := 8;
4747
VALID_POSITION_G : integer range 0 to 31 := 0;
48-
VALID_POLARITY_G : sl := '0'
49-
);
48+
VALID_POLARITY_G : sl := '0');
5049
port (
51-
5250
-- AXI Interface (axiClk)
5351
axiClk : in sl;
5452
axiClkRst : in sl;
@@ -61,16 +59,14 @@ entity AxiLiteFifoPop is
6159
loopFifoValid : out slv(LOOP_FIFO_COUNT_G-1 downto 0);
6260
loopFifoAEmpty : out slv(LOOP_FIFO_COUNT_G-1 downto 0);
6361
loopFifoAFull : out slv(LOOP_FIFO_COUNT_G-1 downto 0);
64-
6562
-- POP FIFO Write Interface (popFifoClk)
6663
popFifoClk : in slv(POP_FIFO_COUNT_G-1 downto 0);
6764
popFifoRst : in slv(POP_FIFO_COUNT_G-1 downto 0);
6865
popFifoWrite : in slv(POP_FIFO_COUNT_G-1 downto 0);
6966
popFifoDin : in Slv32Array(POP_FIFO_COUNT_G-1 downto 0);
7067
popFifoFull : out slv(POP_FIFO_COUNT_G-1 downto 0);
7168
popFifoAFull : out slv(POP_FIFO_COUNT_G-1 downto 0);
72-
popFifoPFull : out slv(POP_FIFO_COUNT_G-1 downto 0)
73-
);
69+
popFifoPFull : out slv(POP_FIFO_COUNT_G-1 downto 0));
7470
end AxiLiteFifoPop;
7571

7672
architecture structure of AxiLiteFifoPop is
@@ -129,7 +125,7 @@ begin
129125
CASCADE_SIZE_G => 1,
130126
LAST_STAGE_ASYNC_G => true,
131127
RST_POLARITY_G => '1',
132-
RST_ASYNC_G => true,
128+
RST_ASYNC_G => RST_ASYNC_G,
133129
GEN_SYNC_FIFO_G => POP_SYNC_FIFO_G,
134130
MEMORY_TYPE_G => POP_MEMORY_TYPE_G,
135131
FWFT_EN_G => true,
@@ -182,7 +178,7 @@ begin
182178
CASCADE_SIZE_G => 1,
183179
LAST_STAGE_ASYNC_G => true,
184180
RST_POLARITY_G => '1',
185-
RST_ASYNC_G => true,
181+
RST_ASYNC_G => RST_ASYNC_G,
186182
GEN_SYNC_FIFO_G => true,
187183
MEMORY_TYPE_G => LOOP_MEMORY_TYPE_G,
188184
FWFT_EN_G => true,
@@ -237,16 +233,7 @@ begin
237233
-- AXI Lite
238234
-----------------------------------------
239235

240-
-- Sync
241-
process (axiClk) is
242-
begin
243-
if (rising_edge(axiClk)) then
244-
r <= rin after TPD_G;
245-
end if;
246-
end process;
247-
248-
-- Async
249-
process (r, axiClkRst, axiReadMaster, axiWriteMaster, ipopFifoDout, ipopFifoValid, iloopFifoDout, iloopFifoValid ) is
236+
comb : process (r, axiClkRst, axiReadMaster, axiWriteMaster, ipopFifoDout, ipopFifoValid, iloopFifoDout, iloopFifoValid ) is
250237
variable v : RegType;
251238
variable axiStatus : AxiLiteStatusType;
252239
begin
@@ -303,7 +290,7 @@ begin
303290
end if;
304291

305292
-- Reset
306-
if (axiClkRst = '1') then
293+
if (RST_ASYNC_G = false and axiClkRst = '1') then
307294
v := REG_INIT_C;
308295
end if;
309296

@@ -318,7 +305,15 @@ begin
318305
iloopFifoWrite <= r.loopFifoWrite;
319306
iloopFifoRead <= r.loopFifoRead;
320307

321-
end process;
308+
end process comb;
322309

323-
end architecture structure;
310+
seq : process (axiClk, axiClkRst) is
311+
begin
312+
if (RST_ASYNC_G and axiClkRst = '1') then
313+
r <= REG_INIT_C after TPD_G;
314+
elsif rising_edge(axiClk) then
315+
r <= rin after TPD_G;
316+
end if;
317+
end process seq;
324318

319+
end architecture structure;

0 commit comments

Comments
 (0)