aboutsummaryrefslogtreecommitdiffstats
path: root/techlibs/intel_alm/common/quartus_rename.v
blob: 3b4628675983307c78a1f6b26e3604a21b131b33 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
`ifdef cyclonev
`define LCELL cyclonev_lcell_comb
`define MAC cyclonev_mac
`define MLAB cyclonev_mlab_cell
`endif
`ifdef cyclone10gx
`define LCELL cyclone10gx_lcell_comb
`define MAC cyclone10gx_mac
`define MLAB cyclone10gx_mlab_cell
`endif

module __MISTRAL_VCC(output Q);

MISTRAL_ALUT2 #(.LUT(4'b1111)) _TECHMAP_REPLACE_ (.A(1'b1), .B(1'b1), .Q(Q));

endmodule


module __MISTRAL_GND(output Q);

MISTRAL_ALUT2 #(.LUT(4'b0000)) _TECHMAP_REPLACE_ (.A(1'b1), .B(1'b1), .Q(Q));

endmodule


module MISTRAL_FF(input DATAIN, CLK, ACLR, ENA, SCLR, SLOAD, SDATA, output reg Q);

dffeas #(.power_up("low"), .is_wysiwyg("true")) _TECHMAP_REPLACE_ (.d(DATAIN), .clk(CLK), .clrn(ACLR), .ena(ENA), .sclr(SCLR), .sload(SLOAD), .asdata(SDATA), .q(Q));

endmodule


module MISTRAL_ALUT6(input A, B, C, D, E, F, output Q);
parameter [63:0] LUT = 64'h0000_0000_0000_0000;

`LCELL #(.lut_mask(LUT)) _TECHMAP_REPLACE_ (.dataa(A), .datab(B), .datac(C), .datad(D), .datae(E), .dataf(F), .combout(Q));

endmodule


module MISTRAL_ALUT5(input A, B, C, D, E, output Q);
parameter [31:0] LUT = 32'h0000_0000;

`LCELL #(.lut_mask({2{LUT}})) _TECHMAP_REPLACE_ (.dataa(A), .datab(B), .datac(C), .datad(D), .datae(E), .combout(Q));

endmodule


module MISTRAL_ALUT4(input A, B, C, D, output Q);
parameter [15:0] LUT = 16'h0000;

`LCELL #(.lut_mask({4{LUT}})) _TECHMAP_REPLACE_ (.dataa(A), .datab(B), .datac(C), .datad(D), .combout(Q));

endmodule


module MISTRAL_ALUT3(input A, B, C, output Q);
parameter [7:0] LUT = 8'h00;

`LCELL #(.lut_mask({8{LUT}})) _TECHMAP_REPLACE_ (.dataa(A), .datab(B), .datac(C), .combout(Q));

endmodule


module MISTRAL_ALUT2(input A, B, output Q);
parameter [3:0] LUT = 4'h0;

`LCELL #(.lut_mask({16{LUT}})) _TECHMAP_REPLACE_ (.dataa(A), .datab(B), .combout(Q));

endmodule


module MISTRAL_NOT(input A, output Q);

NOT _TECHMAP_REPLACE_ (.IN(A), .OUT(Q));

endmodule


module MISTRAL_ALUT_ARITH(input A, B, C, D0, D1, CI, output SO, CO);
parameter LUT0 = 16'h0000;
parameter LUT1 = 16'h0000;

`LCELL #(.lut_mask({16'h0, LUT1, 16'h0, LUT0})) _TECHMAP_REPLACE_ (.dataa(A), .datab(B), .datac(C), .datad(D0), .dataf(D1), .cin(CI), .sumout(SO), .cout(CO));

endmodule


module MISTRAL_MLAB(input [4:0] A1ADDR, input A1DATA, A1EN, CLK1, input [4:0] B1ADDR, output B1DATA);

parameter _TECHMAP_CELLNAME_ = "";

// Here we get to an unfortunate situation. The cell has a mem_init0 parameter,
// which takes in a hexadecimal string that could be used to initialise RAM.
// In the vendor simulation models, this appears to work fine, but Quartus,
// either intentionally or not, forgets about this parameter and initialises the
// RAM to zero.
//
// Because of this, RAM initialisation is presently disabled, but the source
// used to generate mem_init0 is kept (commented out) in case this gets fixed
// or an undocumented way to get Quartus to initialise from mem_init0 is found.

`MLAB #(
    .logical_ram_name(_TECHMAP_CELLNAME_),
    .logical_ram_depth(32),
    .logical_ram_width(1),
    .mixed_port_feed_through_mode("Dont Care"),
    .first_bit_number(0),
    .first_address(0),
    .last_address(31),
    .address_width(5),
    .data_width(1),
    .byte_enable_mask_width(1),
    .port_b_data_out_clock("NONE"),
    // .mem_init0($sformatf("%08x", INIT))
) _TECHMAP_REPLACE_ (
    .portaaddr(A1ADDR),
    .portadatain(A1DATA),
    .portbaddr(B1ADDR),
    .portbdataout(B1DATA),
    .ena0(A1EN),
    .clk0(CLK1)
);

endmodule


module MISTRAL_M10K(A1ADDR, A1DATA, A1EN, CLK1, B1ADDR, B1DATA, B1EN);

parameter CFG_ABITS = 10;
parameter CFG_DBITS = 10;

parameter _TECHMAP_CELLNAME_ = "";

input [CFG_ABITS-1:0] A1ADDR, B1ADDR;
input [CFG_DBITS-1:0] A1DATA;
input CLK1, A1EN, B1EN;
output [CFG_DBITS-1:0] B1DATA;

// Much like the MLAB, the M10K has mem_init[01234] parameters which would let
// you initialise the RAM cell via hex literals. If they were implemented.

cyclonev_ram_block #(
    .operation_mode("dual_port"),
    .logical_ram_name(_TECHMAP_CELLNAME_),
    .port_a_address_width(CFG_ABITS),
    .port_a_data_width(CFG_DBITS),
    .port_a_logical_ram_depth(2**CFG_ABITS),
    .port_a_logical_ram_width(CFG_DBITS),
    .port_a_first_address(0),
    .port_a_last_address(2**CFG_ABITS - 1),
    .port_a_first_bit_number(0),
    .port_b_address_width(CFG_ABITS),
    .port_b_data_width(CFG_DBITS),
    .port_b_logical_ram_depth(2**CFG_ABITS),
    .port_b_logical_ram_width(CFG_DBITS),
    .port_b_first_address(0),
    .port_b_last_address(2**CFG_ABITS - 1),
    .port_b_first_bit_number(0),
    .port_b_address_clock("clock0"),
    .port_b_read_enable_clock("clock0")
) _TECHMAP_REPLACE_ (
    .portaaddr(A1ADDR),
    .portadatain(A1DATA),
    .portawe(A1EN),
    .portbaddr(B1ADDR),
    .portbdataout(B1DATA),
    .portbre(B1EN),
    .clk0(CLK1)
);

endmodule


module MISTRAL_MUL27X27(input [26:0] A, B, output [53:0] Y);

parameter A_SIGNED = 1;
parameter B_SIGNED = 1;

`MAC #(
    .ax_width(27),
    .signed_max(A_SIGNED ? "true" : "false"),
    .ay_scan_in_width(27),
    .signed_may(B_SIGNED ? "true" : "false"),
    .result_a_width(54),
    .operation_mode("M27x27")
) _TECHMAP_REPLACE_ (
    .ax(A),
    .ay(B),
    .resulta(Y)
);

endmodule


module MISTRAL_MUL18X18(input [17:0] A, B, output [35:0] Y);

parameter A_SIGNED = 1;
parameter B_SIGNED = 1;

`MAC #(
    .ax_width(18),
    .signed_max(A_SIGNED ? "true" : "false"),
    .ay_scan_in_width(18),
    .signed_may(B_SIGNED ? "true" : "false"),
    .result_a_width(36),
    .operation_mode("M18x18_FULL")
) _TECHMAP_REPLACE_ (
    .ax(A),
    .ay(B),
    .resulta(Y)
);

endmodule


module MISTRAL_MUL9X9(input [8:0] A, B, output [17:0] Y);

parameter A_SIGNED = 1;
parameter B_SIGNED = 1;

`MAC #(
    .ax_width(9),
    .signed_max(A_SIGNED ? "true" : "false"),
    .ay_scan_in_width(9),
    .signed_may(B_SIGNED ? "true" : "false"),
    .result_a_width(18),
    .operation_mode("M9x9")
) _TECHMAP_REPLACE_ (
    .ax(A),
    .ay(B),
    .resulta(Y)
);

endmodule
n class="p">{ /** * @brief Descriptor size in unicode characters. */ size_t ud_size; /** * @brief Pointer to the descriptor. */ const uint8_t *ud_string; } USBDescriptor; /** * @brief Type of an USB generic notification callback. * * @param[in] usbp pointer to the @p USBDriver object triggering the * callback */ typedef void (*usbcallback_t)(USBDriver *usbp); /** * @brief Type of an USB endpoint callback. * * @param[in] usbp pointer to the @p USBDriver object triggering the * callback * @param[in] ep endpoint number */ typedef void (*usbepcallback_t)(USBDriver *usbp, usbep_t ep); /** * @brief Type of an USB event notification callback. * * @param[in] usbp pointer to the @p USBDriver object triggering the * callback * @param[in] event event type */ typedef void (*usbeventcb_t)(USBDriver *usbp, usbevent_t event); /** * @brief Type of a requests handler callback. * @details The request is encoded in the @p usb_setup buffer. * * @param[in] usbp pointer to the @p USBDriver object triggering the * callback * @return The request handling exit code. * @retval false Request not recognized by the handler. * @retval true Request handled. */ typedef bool (*usbreqhandler_t)(USBDriver *usbp); /** * @brief Type of an USB descriptor-retrieving callback. */ typedef const USBDescriptor * (*usbgetdescriptor_t)(USBDriver *usbp, uint8_t dtype, uint8_t dindex, uint16_t lang); #include "usb_lld.h" /*===========================================================================*/ /* Driver macros. */ /*===========================================================================*/ /** * @name Macro Functions * @{ */ /** * @brief Returns the driver state. * * @param[in] usbp pointer to the @p USBDriver object * @return The driver state. * * @iclass */ #define usbGetDriverStateI(usbp) ((usbp)->state) /** * @brief Connects the USB device. * * @param[in] usbp pointer to the @p USBDriver object * * @api */ #define usbConnectBus(usbp) usb_lld_connect_bus(usbp) /** * @brief Disconnect the USB device. * * @param[in] usbp pointer to the @p USBDriver object * * @api */ #define usbDisconnectBus(usbp) usb_lld_disconnect_bus(usbp) /** * @brief Returns the current frame number. * * @param[in] usbp pointer to the @p USBDriver object * @return The current frame number. * * @api */ #define usbGetFrameNumber(usbp) usb_lld_get_frame_number(usbp) /** * @brief Returns the status of an IN endpoint. * * @param[in] usbp pointer to the @p USBDriver object * @param[in] ep endpoint number * @return The operation status. * @retval false Endpoint ready. * @retval true Endpoint transmitting. * * @iclass */ #define usbGetTransmitStatusI(usbp, ep) \ (((usbp)->transmitting & (uint16_t)((unsigned)1U << (unsigned)(ep))) != 0U) /** * @brief Returns the status of an OUT endpoint. * * @param[in] usbp pointer to the @p USBDriver object * @param[in] ep endpoint number * @return The operation status. * @retval false Endpoint ready. * @retval true Endpoint receiving. * * @iclass */ #define usbGetReceiveStatusI(usbp, ep) \ (((usbp)->receiving & (uint16_t)((unsigned)1U << (unsigned)(ep))) != 0U) /** * @brief Returns the exact size of a receive transaction. * @details The received size can be different from the size specified in * @p usbStartReceiveI() because the last packet could have a size * different from the expected one. * * @param[in] usbp pointer to the @p USBDriver object * @param[in] ep endpoint number * @return Received data size. * * @iclass */ #define usbGetReceiveTransactionSizeI(usbp, ep) \ usb_lld_get_transaction_size(usbp, ep) /** * @brief Request transfer setup. * @details This macro is used by the request handling callbacks in order to * prepare a transaction over the endpoint zero. * * @param[in] usbp pointer to the @p USBDriver object * @param[in] buf pointer to a buffer for the transaction data * @param[in] n number of bytes to be transferred * @param[in] endcb callback to be invoked after the transfer or @p NULL * * @api */ #define usbSetupTransfer(usbp, buf, n, endcb) { \ (usbp)->ep0next = (buf); \ (usbp)->ep0n = (n); \ (usbp)->ep0endcb = (endcb); \ } /** * @brief Reads a setup packet from the dedicated packet buffer. * @details This function must be invoked in the context of the @p setup_cb * callback in order to read the received setup packet. * @pre In order to use this function the endpoint must have been * initialized as a control endpoint. * @note This function can be invoked both in thread and IRQ context. * * @param[in] usbp pointer to the @p USBDriver object * @param[in] ep endpoint number * @param[out] buf buffer where to copy the packet data * * @special */ #define usbReadSetup(usbp, ep, buf) usb_lld_read_setup(usbp, ep, buf) /** @} */ /** * @name Low level driver helper macros * @{ */ /** * @brief Common ISR code, usb event callback. * * @param[in] usbp pointer to the @p USBDriver object * @param[in] evt USB event code * * @notapi */ #define _usb_isr_invoke_event_cb(usbp, evt) { \ if (((usbp)->config->event_cb) != NULL) { \ (usbp)->config->event_cb(usbp, evt); \ } \ } /** * @brief Common ISR code, SOF callback. * * @param[in] usbp pointer to the @p USBDriver object * * @notapi */ #define _usb_isr_invoke_sof_cb(usbp) { \ if (((usbp)->config->sof_cb) != NULL) { \ (usbp)->config->sof_cb(usbp); \ } \ } /** * @brief Common ISR code, setup packet callback. * * @param[in] usbp pointer to the @p USBDriver object * @param[in] ep endpoint number * * @notapi */ #define _usb_isr_invoke_setup_cb(usbp, ep) { \ (usbp)->epc[ep]->setup_cb(usbp, ep); \ } /** * @brief Common ISR code, IN endpoint callback. * * @param[in] usbp pointer to the @p USBDriver object * @param[in] ep endpoint number * * @notapi */ #define _usb_isr_invoke_in_cb(usbp, ep) { \ (usbp)->transmitting &= ~(1 << (ep)); \ (usbp)->epc[ep]->in_cb(usbp, ep); \ } /** * @brief Common ISR code, OUT endpoint event. * * @param[in] usbp pointer to the @p USBDriver object * @param[in] ep endpoint number * * @notapi */ #define _usb_isr_invoke_out_cb(usbp, ep) { \ (usbp)->receiving &= ~(1 << (ep)); \ (usbp)->epc[ep]->out_cb(usbp, ep); \ } /** @} */ /*===========================================================================*/ /* External declarations. */ /*===========================================================================*/ #ifdef __cplusplus extern "C" { #endif void usbInit(void); void usbObjectInit(USBDriver *usbp); void usbStart(USBDriver *usbp, const USBConfig *config); void usbStop(USBDriver *usbp); void usbInitEndpointI(USBDriver *usbp, usbep_t ep, const USBEndpointConfig *epcp); void usbDisableEndpointsI(USBDriver *usbp); void usbReadSetupI(USBDriver *usbp, usbep_t ep, uint8_t *buf); void usbPrepareReceive(USBDriver *usbp, usbep_t ep, uint8_t *buf, size_t n); void usbPrepareTransmit(USBDriver *usbp, usbep_t ep, const uint8_t *buf, size_t n); void usbPrepareQueuedReceive(USBDriver *usbp, usbep_t ep, input_queue_t *iqp, size_t n); void usbPrepareQueuedTransmit(USBDriver *usbp, usbep_t ep, output_queue_t *oqp, size_t n); bool usbStartReceiveI(USBDriver *usbp, usbep_t ep); bool usbStartTransmitI(USBDriver *usbp, usbep_t ep); bool usbStallReceiveI(USBDriver *usbp, usbep_t ep); bool usbStallTransmitI(USBDriver *usbp, usbep_t ep); void _usb_reset(USBDriver *usbp); void _usb_ep0setup(USBDriver *usbp, usbep_t ep); void _usb_ep0in(USBDriver *usbp, usbep_t ep); void _usb_ep0out(USBDriver *usbp, usbep_t ep); #ifdef __cplusplus } #endif #endif /* HAL_USE_USB == TRUE */ #endif /* _USB_H_ */ /** @} */