diff --git a/flow/lint b/flow/lint new file mode 100755 index 0000000000000000000000000000000000000000..b9a276ee8566076c6dfe85634fc15b06ee9974d5 --- /dev/null +++ b/flow/lint @@ -0,0 +1,14 @@ +#----------------------------------------------------------------------------- +# SoC Labs socsim script to run linting +# A joint work commissioned on behalf of SoC Labs, under Arm Academic Access license. +# +# Contributors +# +# David Mapstone (d.a.mapstone@soton.ac.uk) +# +# Copyright 2022, SoC Labs (www.soclabs.org) +#----------------------------------------------------------------------------- + +#!/usr/bin/env bash + +verilator --lint-only $* \ No newline at end of file diff --git a/simulate/simulators/ivlog_sim.sh b/flow/simulators/ivlog_sim.sh similarity index 100% rename from simulate/simulators/ivlog_sim.sh rename to flow/simulators/ivlog_sim.sh diff --git a/simulate/socsim b/flow/socsim similarity index 100% rename from simulate/socsim rename to flow/socsim diff --git a/hdl/src/primatives/vr_fifo.sv b/hdl/src/primatives/vr_fifo.sv index 41ebcb470a41325c01e5eca3d5f5ddee120b5f22..87b4a11895a93f5aa0ab294bcae398b6e7a19302 100644 --- a/hdl/src/primatives/vr_fifo.sv +++ b/hdl/src/primatives/vr_fifo.sv @@ -17,26 +17,29 @@ module vr_fifo #( input logic nrst, input logic en, + // Synchronous, localised reset + input logic sync_rst, + // In (Write) Control input logic [DATA_W-1:0] in_data, + input logic in_last, input logic in_valid, output logic in_ready, // Out (Read) Control output logic [DATA_W-1:0] out_data, + output logic out_last, input logic out_ready, output logic out_valid ); - - assign out_data = fifo [read_ptr[PTR_W-2:0]]; // Output Data is dereferenced value of the Read Pointer - + logic in_shake; // Successful Write Handshake logic out_shake; // Successful Read Handshake assign in_shake = (in_valid == 1'b1) && (in_ready == 1'b1); assign out_shake = (out_valid == 1'b1) && (out_ready == 1'b1); - logic [DATA_W-1:0] fifo [DEPTH-1:0]; // FIFO Memory Structure + logic [DATA_W:0] fifo [DEPTH-1:0]; // FIFO Memory Structure logic [PTR_W-1:0] write_ptr; // FIFO Write Pointer logic [PTR_W-1:0] read_ptr; // FIFO Read Pointer logic [PTR_W-1:0] ptr_dif; // Difference between Write and Read Pointers @@ -56,8 +59,10 @@ module vr_fifo #( // WriteValid: WritePtr - ReadPtr < 3'd4 // ReadValid: WritePtr - ReadPtr - 1 < 3'd4 + assign {out_data,out_last} = fifo [read_ptr[PTR_W-2:0]]; // Output Data is dereferenced value of the Read Pointer + always_ff @(posedge clk, negedge nrst) begin - if (!nrst) begin + if ((!nrst) || sync_rst) begin // Under Reset // - Pointers reset to 0 (FIFO is empty without needing to reset the memories) // - Control taken low @@ -72,7 +77,7 @@ module vr_fifo #( // Empty Rows in FIFO in FIFO if (in_shake) begin // Successful Handshake store data in FIFO and increment Write Pointer - fifo [write_ptr[PTR_W-2:0]] <= in_data; + fifo [write_ptr[PTR_W-2:0]] <= {in_data,in_last}; write_ptr <= write_ptr + 1; if ((ptr_dif + (1 - out_shake)) < DEPTH) begin // Still space in FIFO after latest write diff --git a/sourceme b/sourceme index 2d9744889d293a8ddfad92d429125b07e9b02815..cf1cc8e652e446a74ac11082a922c09534ee0a0f 100755 --- a/sourceme +++ b/sourceme @@ -14,8 +14,8 @@ # Set environment Variables for Repository export SHA_2_ACC_DIR="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" -# Add simulation directory to Path -export PATH=$PATH:$SHA_2_ACC_DIR/simulate +# Add flow directory to Path +export PATH=$PATH:$SHA_2_ACC_DIR/flow # Set Default Simulator export SIMULATOR="ivlog" \ No newline at end of file