aboutsummaryrefslogtreecommitdiffstats
path: root/techlibs/intel_alm/common/alm_map.v
blob: fe646c5d6af9918e57c31c1889bb565afc2e5eb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
module \$lut (A, Y);

parameter WIDTH = 1;
parameter LUT = 0;

input [WIDTH-1:0] A;
output Y;

generate
    if (WIDTH == 1) begin
        generate
            if (LUT == 2'b00) begin
                assign Y = 1'b0;
            end
            else if (LUT == 2'b01) begin
                MISTRAL_NOT _TECHMAP_REPLACE_(
                    .A(A[0]), .Q(Y)
                );
            end
            else if (LUT == 2'b10) begin
                assign Y = A;
            end
            else if (LUT == 2'b11) begin
                assign Y = 1'b1;
            end
        endgenerate
    end else
    if (WIDTH == 2) begin
        MISTRAL_ALUT2 #(.LUT(LUT)) _TECHMAP_REPLACE_(
            .A(A[0]), .B(A[1]), .Q(Y)
        );
    end else
    if (WIDTH == 3) begin
        MISTRAL_ALUT3 #(.LUT(LUT)) _TECHMAP_REPLACE_(
            .A(A[0]), .B(A[1]), .C(A[2]), .Q(Y)
        );
    end else
    if (WIDTH == 4) begin
        MISTRAL_ALUT4 #(.LUT(LUT)) _TECHMAP_REPLACE_(
            .A(A[0]), .B(A[1]), .C(A[2]), .D(A[3]), .Q(Y)
        );
    end else
    if (WIDTH == 5) begin
        MISTRAL_ALUT5 #(.LUT(LUT)) _TECHMAP_REPLACE_ (
            .A(A[0]), .B(A[1]), .C(A[2]), .D(A[3]), .E(A[4]), .Q(Y)
        );
    end else
    if (WIDTH == 6) begin
        MISTRAL_ALUT6 #(.LUT(LUT)) _TECHMAP_REPLACE_ (
            .A(A[0]), .B(A[1]), .C(A[2]), .D(A[3]), .E(A[4]), .F(A[5]), .Q(Y)
        );
    end else begin
        wire _TECHMAP_FAIL_ = 1'b1;
    end
endgenerate
endmodule
/span> I in Design_Units.First .. Design_Units.Last loop Vhdl.Annotations.Annotate (Design_Units.Table (I)); end loop; end Compile_Elab; -- Set options. procedure Set_Run_Options (Args : Argument_List) is use Grt.Options; use Types; Arg : String_Access; Status : Decode_Option_Status; Argv0 : String_Acc; begin -- Set progname (used for grt error messages) Argv0 := new String'(Ada.Command_Line.Command_Name & ASCII.Nul); Grt.Options.Progname := Grt.Types.To_Ghdl_C_String (Argv0.all'Address); Grt.Errors.Set_Error_Stream (Grt.Stdio.stdout); Grtlink.Flag_String := Flags.Flag_String; Grt.Options.Set_Time_Resolution; for I in Args'Range loop Arg := Args (I); if Arg.all = "--disp-tree" then Simul.Simulation.Disp_Tree := True; elsif Arg.all = "--expect-failure" then Decode_Option (Arg.all, Status); pragma Assert (Status = Decode_Option_Ok); elsif Arg.all = "--trace-elab" then Simul.Elaboration.Trace_Elaboration := True; elsif Arg.all = "--trace-drivers" then Simul.Elaboration.Trace_Drivers := True; elsif Arg.all = "--trace-simu" then Simul.Simulation.Trace_Simulation := True; elsif Arg.all = "--trace-stmt" then Simul.Execution.Trace_Statements := True; elsif Arg.all = "--stats" then Simul.Simulation.Disp_Stats := True; elsif Arg.all = "-i" then Simul.Debugger.Flag_Debugger := True; Simul.Debugger.Flag_Interractive := True; else Decode_Option (Arg.all, Status); case Status is when Decode_Option_Last => exit; when Decode_Option_Stop => Grt.Options.Flag_No_Run := True; when Decode_Option_Ok => null; end case; -- Ghdlmain.Error ("unknown run options '" & Arg.all & "'"); -- raise Option_Error; end if; end loop; end Set_Run_Options; procedure Run is use Ada.Command_Line; begin if Grt.Options.Flag_No_Run then -- Some options like --has-feature set the exit status. Set_Exit_Status (Exit_Status (Grt.Errors.Exit_Status)); return; end if; Simul.Simulation.Main.Simulation_Entity (Top_Conf); Set_Exit_Status (Exit_Status (Grt.Errors.Exit_Status)); end Run; function Decode_Option (Option : String) return Boolean is begin if Option = "--debug" or Option = "-g" then Simul.Debugger.Flag_Debugger := True; else return False; end if; return True; end Decode_Option; procedure Disp_Long_Help is begin Simple_IO.Put_Line (" --debug Run with debugger"); end Disp_Long_Help; function Get_Top_Config return Iir is begin return Top_Conf; end Get_Top_Config; procedure Set_Hooks is begin Ghdlcomp.Hooks := (Compile_Init'Access, Compile_Elab'Access, Set_Run_Options'Access, Run'Access, Decode_Option'Access, Disp_Long_Help'Access); end Set_Hooks; procedure Register_Commands is begin Set_Hooks; Ghdlcomp.Register_Commands; end Register_Commands; procedure Compile_Init is begin Ghdllocal.Compile_Init; Set_Hooks; end Compile_Init; end Ghdlsimul;