Skip to content

Commit fa523d8

Browse files
committed
[FIRRTL] Emit fopen calls to get fd's not mcd's.
Multichannel descriptors are limited to 30, where file descriptors usually have a much higher limit. Specify opening files "w" which will truncate and is not binary; this may be a change depending on default behavior of mcd's.
1 parent bf6b633 commit fa523d8

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/Conversion/FIRRTLToHW/LowerToHW.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ package __circt_lib_logging;
909909
static int global_id [string];
910910
static function int get(string name);
911911
if (global_id.exists(name) == 32'h0) begin
912-
global_id[name] = $fopen(name);
912+
global_id[name] = $fopen(name, "w");
913913
if (global_id[name] == 32'h0)
914914
$error("Failed to open file %s", name);
915915
end

test/Conversion/FIRRTLToHW/lower-to-hw.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ firrtl.circuit "Simple" attributes {annotations = [{class =
2020
// CHECK-SAME: static int global_id [string];
2121
// CHECK-SAME: static function int get(string name);
2222
// CHECK-SAME: if (global_id.exists(name) == 32'h0)
23-
// CHECK-SAME: global_id[name] = $fopen(name);
23+
// CHECK-SAME: global_id[name] = $fopen(name, \22w\22);
2424
// CHECK-SAME: return global_id[name];
2525
// CHECK-SAME: endfunction
2626
// CHECK-SAME: endclass

test/firtool/print.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ FIRRTL version 5.1.0
1010
; CHECK-NEXT: static int global_id [string];
1111
; CHECK-NEXT: static function int get(string name);
1212
; CHECK-NEXT: if (global_id.exists(name) == 32'h0) begin
13-
; CHECK-NEXT: global_id[name] = $fopen(name);
13+
; CHECK-NEXT: global_id[name] = $fopen(name, "w");
1414
; CHECK-NEXT: if (global_id[name] == 32'h0)
1515
; CHECK-NEXT: $error("Failed to open file %s", name);
1616
; CHECK-NEXT: end

0 commit comments

Comments
 (0)