aboutsummaryrefslogtreecommitdiffstats
path: root/techlibs/ice40/cells_map.v
blob: 759549e30cc183bb662c805fa86863f3e6fce1c3 (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
module  \$_DFF_N_ (input D, C, output Q); SB_DFFN _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C)); endmodule
module  \$_DFF_P_ (input D, C, output Q); SB_DFF  _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C)); endmodule

module  \$_DFFE_NN_ (input D, C, E, output Q); SB_DFFNE _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C), .E(!E)); endmodule
module  \$_DFFE_PN_ (input D, C, E, output Q); SB_DFFE  _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C), .E(!E)); endmodule

module  \$_DFFE_NP_ (input D, C, E, output Q); SB_DFFNE _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C), .E(E)); endmodule
module  \$_DFFE_PP_ (input D, C, E, output Q); SB_DFFE  _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C), .E(E)); endmodule

module  \$_DFF_NN0_ (input D, C, R, output Q); SB_DFFNR _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C), .R(!R)); endmodule
module  \$_DFF_NN1_ (input D, C, R, output Q); SB_DFFNS _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C), .S(!R)); endmodule
module  \$_DFF_PN0_ (input D, C, R, output Q); SB_DFFR  _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C), .R(!R)); endmodule
module  \$_DFF_PN1_ (input D, C, R, output Q); SB_DFFS  _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C), .S(!R)); endmodule

module  \$_DFF_NP0_ (input D, C, R, output Q); SB_DFFNR _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C), .R(R)); endmodule
module  \$_DFF_NP1_ (input D, C, R, output Q); SB_DFFNS _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C), .S(R)); endmodule
module  \$_DFF_PP0_ (input D, C, R, output Q); SB_DFFR  _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C), .R(R)); endmodule
module  \$_DFF_PP1_ (input D, C, R, output Q); SB_DFFS  _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C), .S(R)); endmodule

module  \$__DFFE_NN0 (input D, C, E, R, output Q); SB_DFFNER _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C), .E(E), .R(!R)); endmodule
module  \$__DFFE_NN1 (input D, C, E, R, output Q); SB_DFFNES _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C), .E(E), .S(!R)); endmodule
module  \$__DFFE_PN0 (input D, C, E, R, output Q); SB_DFFER  _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C), .E(E), .R(!R)); endmodule
module  \$__DFFE_PN1 (input D, C, E, R, output Q); SB_DFFES  _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C), .E(E), .S(!R)); endmodule

module  \$__DFFE_NP0 (input D, C, E, R, output Q); SB_DFFNER _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C), .E(E), .R(R)); endmodule
module  \$__DFFE_NP1 (input D, C, E, R, output Q); SB_DFFNES _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C), .E(E), .S(R)); endmodule
module  \$__DFFE_PP0 (input D, C, E, R, output Q); SB_DFFER  _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C), .E(E), .R(R)); endmodule
module  \$__DFFE_PP1 (input D, C, E, R, output Q); SB_DFFES  _TECHMAP_REPLACE_ (.D(D), .Q(Q), .C(C), .E(E), .S(R)); endmodule

`ifndef NO_LUT
module \$lut (A, Y);
  parameter WIDTH = 0;
  parameter LUT = 0;

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

  generate
    if (WIDTH == 1) begin
      localparam [15:0] INIT = {{8{LUT[1]}}, {8{LUT[0]}}};
      SB_LUT4 #(.LUT_INIT(INIT)) _TECHMAP_REPLACE_ (.O(Y),
        .I0(1'b0), .I1(1'b0), .I2(1'b0), .I3(A[0]));
    end else
    if (WIDTH == 2) begin
      localparam [15:0] INIT = {{4{LUT[3]}}, {4{LUT[1]}}, {4{LUT[2]}}, {4{LUT[0]}}};
      SB_LUT4 #(.LUT_INIT(INIT)) _TECHMAP_REPLACE_ (.O(Y),
        .I0(1'b0), .I1(1'b0), .I2(A[1]), .I3(A[0]));
    end else
    if (WIDTH == 3) begin
      localparam [15:0] INIT = {{2{LUT[7]}}, {2{LUT[3]}}, {2{LUT[5]}}, {2{LUT[1]}}, {2{LUT[6]}}, {2{LUT[2]}}, {2{LUT[4]}}, {2{LUT[0]}}};
      SB_LUT4 #(.LUT_INIT(INIT)) _TECHMAP_REPLACE_ (.O(Y),
        .I0(1'b0), .I1(A[2]), .I2(A[1]), .I3(A[0]));
    end else
    if (WIDTH == 4) begin
      localparam [15:0] INIT = {LUT[15], LUT[7], LUT[11], LUT[3], LUT[13], LUT[5], LUT[9], LUT[1], LUT[14], LUT[6], LUT[10], LUT[2], LUT[12], LUT[4], LUT[8], LUT[0]};
      SB_LUT4 #(.LUT_INIT(INIT)) _TECHMAP_REPLACE_ (.O(Y),
        .I0(A[3]), .I1(A[2]), .I2(A[1]), .I3(A[0]));
    end else begin
      wire _TECHMAP_FAIL_ = 1;
    end
  endgenerate
endmodule
`endif
class="cm"> * @details If enabled then the mutexes APIs are included in the kernel. * * @note The default is @p TRUE. */ # if !defined(CH_CFG_USE_MUTEXES) # define CH_CFG_USE_MUTEXES TRUE # endif /** * @brief Enables recursive behavior on mutexes. * @note Recursive mutexes are heavier and have an increased * memory footprint. * * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ # if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) # define CH_CFG_USE_MUTEXES_RECURSIVE FALSE # endif /** * @brief Conditional Variables APIs. * @details If enabled then the conditional variables APIs are included * in the kernel. * * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ # if !defined(CH_CFG_USE_CONDVARS) # define CH_CFG_USE_CONDVARS TRUE # endif /** * @brief Conditional Variables APIs with timeout. * @details If enabled then the conditional variables APIs with timeout * specification are included in the kernel. * * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ # if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) # define CH_CFG_USE_CONDVARS_TIMEOUT TRUE # endif /** * @brief Events Flags APIs. * @details If enabled then the event flags APIs are included in the kernel. * * @note The default is @p TRUE. */ # if !defined(CH_CFG_USE_EVENTS) # define CH_CFG_USE_EVENTS TRUE # endif /** * @brief Events Flags APIs with timeout. * @details If enabled then the events APIs with timeout specification * are included in the kernel. * * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ # if !defined(CH_CFG_USE_EVENTS_TIMEOUT) # define CH_CFG_USE_EVENTS_TIMEOUT TRUE # endif /** * @brief Synchronous Messages APIs. * @details If enabled then the synchronous messages APIs are included * in the kernel. * * @note The default is @p TRUE. */ # if !defined(CH_CFG_USE_MESSAGES) # define CH_CFG_USE_MESSAGES TRUE # endif /** * @brief Synchronous Messages queuing mode. * @details If enabled then messages are served by priority rather than in * FIFO order. * * @note The default is @p FALSE. Enable this if you have special * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ # if !defined(CH_CFG_USE_MESSAGES_PRIORITY) # define CH_CFG_USE_MESSAGES_PRIORITY FALSE # endif /** * @brief Mailboxes APIs. * @details If enabled then the asynchronous messages (mailboxes) APIs are * included in the kernel. * * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ # if !defined(CH_CFG_USE_MAILBOXES) # define CH_CFG_USE_MAILBOXES TRUE # endif /** * @brief Core Memory Manager APIs. * @details If enabled then the core memory manager APIs are included * in the kernel. * * @note The default is @p TRUE. */ # if !defined(CH_CFG_USE_MEMCORE) # define CH_CFG_USE_MEMCORE TRUE # endif /** * @brief Heap Allocator APIs. * @details If enabled then the memory heap allocator APIs are included * in the kernel. * * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ # if !defined(CH_CFG_USE_HEAP) # define CH_CFG_USE_HEAP TRUE # endif /** * @brief Memory Pools Allocator APIs. * @details If enabled then the memory pools allocator APIs are included * in the kernel. * * @note The default is @p TRUE. */ # if !defined(CH_CFG_USE_MEMPOOLS) # define CH_CFG_USE_MEMPOOLS TRUE # endif /** * @brief Objects FIFOs APIs. * @details If enabled then the objects FIFOs APIs are included * in the kernel. * * @note The default is @p TRUE. */ # if !defined(CH_CFG_USE_OBJ_FIFOS) # define CH_CFG_USE_OBJ_FIFOS TRUE # endif /** * @brief Pipes APIs. * @details If enabled then the pipes APIs are included * in the kernel. * * @note The default is @p TRUE. */ # if !defined(CH_CFG_USE_PIPES) # define CH_CFG_USE_PIPES TRUE # endif /** * @brief Dynamic Threads APIs. * @details If enabled then the dynamic threads creation APIs are included * in the kernel. * * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ # if !defined(CH_CFG_USE_DYNAMIC) # define CH_CFG_USE_DYNAMIC TRUE # endif /** @} */ /*===========================================================================*/ /** * @name Objects factory options * @{ */ /*===========================================================================*/ /** * @brief Objects Factory APIs. * @details If enabled then the objects factory APIs are included in the * kernel. * * @note The default is @p FALSE. */ # if !defined(CH_CFG_USE_FACTORY) # define CH_CFG_USE_FACTORY TRUE # endif /** * @brief Maximum length for object names. * @details If the specified length is zero then the name is stored by * pointer but this could have unintended side effects. */ # if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) # define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 # endif /** * @brief Enables the registry of generic objects. */ # if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) # define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE # endif /** * @brief Enables factory for generic buffers. */ # if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) # define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE # endif /** * @brief Enables factory for semaphores. */ # if !defined(CH_CFG_FACTORY_SEMAPHORES) # define CH_CFG_FACTORY_SEMAPHORES TRUE # endif /** * @brief Enables factory for mailboxes. */ # if !defined(CH_CFG_FACTORY_MAILBOXES) # define CH_CFG_FACTORY_MAILBOXES TRUE # endif /** * @brief Enables factory for objects FIFOs. */ # if !defined(CH_CFG_FACTORY_OBJ_FIFOS) # define CH_CFG_FACTORY_OBJ_FIFOS TRUE # endif /** * @brief Enables factory for Pipes. */ # if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__) # define CH_CFG_FACTORY_PIPES TRUE # endif /** @} */ /*===========================================================================*/ /** * @name Debug options * @{ */ /*===========================================================================*/ /** * @brief Debug option, kernel statistics. * * @note The default is @p FALSE. */ # if !defined(CH_DBG_STATISTICS) # define CH_DBG_STATISTICS FALSE # endif /** * @brief Debug option, system state check. * @details If enabled the correct call protocol for system APIs is checked * at runtime. * * @note The default is @p FALSE. */ # if !defined(CH_DBG_SYSTEM_STATE_CHECK) # define CH_DBG_SYSTEM_STATE_CHECK TRUE # endif /** * @brief Debug option, parameters checks. * @details If enabled then the checks on the API functions input * parameters are activated. * * @note The default is @p FALSE. */ # if !defined(CH_DBG_ENABLE_CHECKS) # define CH_DBG_ENABLE_CHECKS TRUE # endif /** * @brief Debug option, consistency checks. * @details If enabled then all the assertions in the kernel code are * activated. This includes consistency checks inside the kernel, * runtime anomalies and port-defined checks. * * @note The default is @p FALSE. */ # if !defined(CH_DBG_ENABLE_ASSERTS) # define CH_DBG_ENABLE_ASSERTS TRUE # endif /** * @brief Debug option, trace buffer. * @details If enabled then the trace buffer is activated. * * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. */ # if !defined(CH_DBG_TRACE_MASK) # define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED # endif /** * @brief Trace buffer entries. * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * different from @p CH_DBG_TRACE_MASK_DISABLED. */ # if !defined(CH_DBG_TRACE_BUFFER_SIZE) # define CH_DBG_TRACE_BUFFER_SIZE 128 # endif /** * @brief Debug option, stack checks. * @details If enabled then a runtime stack check is performed. * * @note The default is @p FALSE. * @note The stack check is performed in a architecture/port dependent way. * It may not be implemented or some ports. * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ # if !defined(CH_DBG_ENABLE_STACK_CHECK) # define CH_DBG_ENABLE_STACK_CHECK TRUE # endif /** * @brief Debug option, stacks initialization. * @details If enabled then the threads working area is filled with a byte * value when a thread is created. This can be useful for the * runtime measurement of the used stack. * * @note The default is @p FALSE. */ # if !defined(CH_DBG_FILL_THREADS) # define CH_DBG_FILL_THREADS TRUE # endif /** * @brief Debug option, threads profiling. * @details If enabled then a field is added to the @p thread_t structure that * counts the system ticks occurred while executing the thread. * * @note The default is @p FALSE. * @note This debug option is not currently compatible with the * tickless mode. */ # if !defined(CH_DBG_THREADS_PROFILING) # define CH_DBG_THREADS_PROFILING FALSE # endif /** @} */ /*===========================================================================*/ /** * @name Kernel hooks * @{ */ /*===========================================================================*/ /** * @brief System structure extension. * @details User fields added to the end of the @p ch_system_t structure. */ # define CH_CFG_SYSTEM_EXTRA_FIELDS /* Add threads custom fields here.*/ /** * @brief System initialization hook. * @details User initialization code added to the @p chSysInit() function * just before interrupts are enabled globally. */ # define CH_CFG_SYSTEM_INIT_HOOK() \ { /* Add threads initialization code here.*/ } /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. */ # define CH_CFG_THREAD_EXTRA_FIELDS /* Add threads custom fields here.*/ /** * @brief Threads initialization hook. * @details User initialization code added to the @p _thread_init() function. * * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ # define CH_CFG_THREAD_INIT_HOOK(tp) \ { /* Add threads initialization code here.*/ } /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. */ # define CH_CFG_THREAD_EXIT_HOOK(tp) \ { /* Add threads finalization code here.*/ } /** * @brief Context switch hook. * @details This hook is invoked just before switching between threads. */ # define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) \ { /* Context switch code here.*/ } /** * @brief ISR enter hook. */ # define CH_CFG_IRQ_PROLOGUE_HOOK() \ { /* IRQ prologue code here.*/ } /** * @brief ISR exit hook. */ # define CH_CFG_IRQ_EPILOGUE_HOOK() \ { /* IRQ epilogue code here.*/ } /** * @brief Idle thread enter hook. * @note This hook is invoked within a critical zone, no OS functions * should be invoked from here. * @note This macro can be used to activate a power saving mode. */ # define CH_CFG_IDLE_ENTER_HOOK() \ { /* Idle-enter code here.*/ } /** * @brief Idle thread leave hook. * @note This hook is invoked within a critical zone, no OS functions * should be invoked from here. * @note This macro can be used to deactivate a power saving mode. */ # define CH_CFG_IDLE_LEAVE_HOOK() \ { /* Idle-leave code here.*/ } /** * @brief Idle Loop hook. * @details This hook is continuously invoked by the idle thread loop. */ # define CH_CFG_IDLE_LOOP_HOOK() \ { /* Idle loop code here.*/ } /** * @brief System tick event hook. * @details This hook is invoked in the system tick handler immediately * after processing the virtual timers queue. */ # define CH_CFG_SYSTEM_TICK_HOOK() \ { /* System tick event code here.*/ } /** * @brief System halt hook. * @details This hook is invoked in case to a system halting error before * the system is halted. */ # define CH_CFG_SYSTEM_HALT_HOOK(reason) \ { /* System halt code here.*/ } /** * @brief Trace hook. * @details This hook is invoked each time a new record is written in the * trace buffer. */ # define CH_CFG_TRACE_HOOK(tep) \ { /* Trace code here.*/ } /** @} */ /*===========================================================================*/ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ #endif /* CHCONF_H */ /** @} */