UCSBarchlab / PyRTL

A collection of classes providing simple hardware specification, simulation, tracing, and testing suitable for teaching and research. Simplicity, usability, clarity, and extensibility are the overarching goals, rather than performance or optimization.
http://ucsbarchlab.github.io/PyRTL
BSD 3-Clause "New" or "Revised" License
257 stars 78 forks source link

Improve Verilog output when a memory doesn't have any writes #400

Closed mdko closed 3 years ago

mdko commented 3 years ago

This continues on the improvements from #399 by doing the check for memory writes per memory, rather than across all of them, when outputting Verilog.

I.e. instead of this (the empty begin ... end):

...
    // Memory mem_0: tmp0
    always @(posedge clk)
    begin
    end
    assign tmp2 = mem_0[in1];

    // Memory mem_1: tmp1
    always @(posedge clk)
    begin
        if (const_0_1) begin
            mem_1[tmp2] <= const_1_42;
        end
    end
...

these changes now cause the following to be produced:

...
    // Memory mem_0: tmp0
    assign tmp2 = mem_0[in1];

    // Memory mem_1: tmp1
    always @(posedge clk)
    begin
        if (const_0_1) begin
            mem_1[tmp2] <= const_1_42;
        end
    end
...
codecov-commenter commented 3 years ago

Codecov Report

Merging #400 (0413976) into development (40f1863) will decrease coverage by 0.00%. The diff coverage is 100.00%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development     #400      +/-   ##
===============================================
- Coverage        90.71%   90.71%   -0.01%     
===============================================
  Files               24       24              
  Lines             5990     5989       -1     
===============================================
- Hits              5434     5433       -1     
  Misses             556      556              
Impacted Files Coverage Δ
pyrtl/importexport.py 85.65% <100.00%> (-0.03%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 40f1863...0413976. Read the comment docs.