text stringlengths 59 71.4k |
|---|
// FSM of Power Gating Process
`include "globalVariable.v"
module fsmPG (clk, reset, portType, portLoad, pgEnable, inPG, inWU, portStatus, outPG, outWU);
input clk, reset, portType, pgEnable, inPG, inWU;
input [`PG_PORT_LOAD_SIZE-1:0] portLoad;
output reg [`PORT_STAT_SIZE-1:0] portStatus;
output reg ... |
#include <bits/stdc++.h> using namespace std; int main() { int s, v1, v2, t1, t2, i1, i2; cin >> s >> v1 >> v2 >> t1 >> t2; i1 = s * v1 + 2 * t1; i2 = s * v2 + 2 * t2; if (i1 < i2) cout << First ; else if (i1 > i2) cout << Second ; else cout << Friendship ; } |
#include <bits/stdc++.h> using namespace std; int main() { int m, n, i, j, k, a, b; scanf( %d , &a); if (a == 1) printf( 1 n ); else { printf( %d n , (a - 1) * a / 2 * 12 + 1); } } |
#include <bits/stdc++.h> using namespace std; const int INF = 1000000007; const long long INF64 = 1000000000000000007; int n; int p[17]{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59}; int a[105]; int number[60]; int dp[105][1 << 17]; int pred[105][1 << 17]; void find_pred(int x, int... |
#include <bits/stdc++.h> using namespace std; int Szukaj(vector<int>& moje, vector<bool>& jest, int x) { int nr = -1; for (int i = 0; i < moje.size(); ++i) { if (moje[i] >= x && jest[i]) { if (nr == -1) nr = i; else { if (moje[i] < moje[nr]) nr = i; } ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 09:07:34 02/15/2017
// Design Name:
// Module Name: car_detector
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
... |
//-----------------------------------------------------------------------------
// (c) Copyright 2012 - 2013 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual proper... |
#include <bits/stdc++.h> using namespace std; template <class T> void check_max(T& a, T b) { if (a < b) a = b; } template <class T> void check_min(T& a, T b) { if (a > b) a = b; } const int MAXN = 10100; int n, k; double per; double a[MAXN]; int main() { cin >> n >> k; per = (dou... |
#include <bits/stdc++.h> using namespace std; int n, nn = 0, pp = 0; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) { int x; scanf( %d , &x); if (x < 0) nn++; else if (x > 0) pp++; } if (nn >= n / 2 + n % 2) printf( -1 ); else if (pp >=... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2E5 + 77; void putint(int x) { static bool first = true; if (first) { printf( %d , x); first = false; } else printf( %d , x); } struct QUERY { int t, r; } Q[maxn]; int cnt = 0; int N, M, A[maxn], B[maxn], p... |
#include <bits/stdc++.h> using namespace std; int main() { int i, j, k, l, m, n; int a[1001]; char s[1000], c; while (scanf( %d%d , &n, &m) != EOF) { memset(a, 0, sizeof(a)); while (m--) { scanf( %s , s); scanf( %s , s); scanf( %s , s); c = s[0]; s... |
#include<bits/stdc++.h> using namespace std; #define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); #define endl n #define mp make_pair #define pb push_back... |
// -*- Verilog -*-
//====================================================================
// DESCRIPTION: Manual test case showing use of AUTOASCII
//
// Copyright 2001-2010 by Wilson Snyder. This program is free software;
// you can redistribute it and/or modify it under the terms of either the GNU
// Lesser General ... |
#include <bits/stdc++.h> using namespace std; bool vis[100006]; int main() { int n, k; while (cin >> n >> k) { memset(vis, false, sizeof(vis)); int st = 1, ed = 1 + k; int cnt = 0; while (cnt < k && st <= ed) { if (st != ed) vis[st] = vis[ed] = true, cout << st <<... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
/*
* Copyright 2020-2022 F4PGA Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; int a[maxn]; int n, x, k; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> x >> k; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); long long ans = 0; for (int i = 0; i < n... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5; const long long INF = 1e18; inline int abs(int x) { return x > 0 ? x : -x; } inline long long sqr(long long x) { return x * x; } bool cmp(pair<int, int>& x, pair<int, int>& y) { return x.first < y.first; } int n; pair<int, int> p[N]; lon... |
#include <bits/stdc++.h> using namespace std; int cnt[26]; bool work() { char ch; while (isalpha(ch = getchar())) ++cnt[ch - a ]; int c = 0; for (int x = 0; x < 26; ++x) if (cnt[x] & 1) ++c; return c == 0 || (c & 1); } int main() { puts(work() ? First : Second ); } |
#include <bits/stdc++.h> using namespace std; int main() { int b, h, a; long long int count = 0; cin >> b >> h; for (int i = h - 1; i >= 0; i = i - 2) { for (int j = b - 1; j >= 0; j = j - 2) { a = j * i; count += a; } } cout << count << endl; return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { long long n, k; cin >> n >> k; if (k < n / 2) { cout << -1; return 0; } if (n == 1) { if (k) cout << -1; else cout << 1; return 0; } int x = k - (n - 2) / 2; cout << x << << 2... |
#include <bits/stdc++.h> using namespace std; const int mod = 998244353; const int N = 1000010; int n, cnt[N], ans, val[N]; long long a[N]; template <typename T> void gi(T &x) { x = 0; register char c = getchar(), pre = 0; for (; c < 0 || c > 9 ; pre = c, c = getchar()) ; for (; c... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; int main() { long long int x, y, a, b, c; cin >> x >> y >> a >> b >> c; long long int t = a * 2; long long int r = c * 3; cout << max(t + b - x, 0ll) + max(r + b - y, 0ll); return 0; } |
#include <bits/stdc++.h> using namespace std; map<int, int> mp, x[1000005]; int main() { int t1; cin >> t1; while (t1--) { string s, t; cin >> s >> t; mp.clear(); for (int i = 0; i < s.size(); i++) mp[s[i]]++; bool q = true; for (int i = 0; i < t.size(); i++) { ... |
#include <bits/stdc++.h> const int N = 400 + 10, MOD = 1000000007; inline void add(int &lhs, long long rhs) { lhs = (lhs + rhs) % MOD; } int n, f[N][N]; int main() { scanf( %d , &n); f[1][0] = f[1][1] = 1; for (int i = 2; i <= n; ++i) { for (int x = 0; x <= n; ++x) { for (int y = 0; x ... |
(* Copyright © 1998-2006
* Henk Barendregt
* Luís Cruz-Filipe
* Herman Geuvers
* Mariusz Giero
* Rik van Ginneken
* Dimitri Hendriks
* Sébastien Hinderer
* Bart Kirkels
* Pierre Letouzey
* Iris Loeb
* Lionel Mamane
* Milad Niqui
* Russell O’Connor
* Randy Pollack
* Nickolay V. Shmyrev
* Bas Spitters
* ... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline T read1() { T t = 0; char k = getchar(); bool flag = 0; while ( 0 > k || k > 9 ) { if (k == - ) flag = 1; k = getchar(); } while ( 0 <= k && k <= 9 ) t = (t << 3) + (t << 1) + (k ^ 48), k = ge... |
#include <bits/stdc++.h> using namespace std; int n; string s; int main() { cin >> n; cin >> s; for (int i = 0; i < n; ++i) { int c1 = 0, c2 = 0; for (int j = i - 1; j >= 0; --j) { if (s[j] == L ) { break; } if (s[j] == R ) { ++c1; } ... |
/*
* Titor - System - PS/2 controller wrapper
* Copyright (C) 2012,2013 Sean Ryan Moore
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; int n; cin >> s; n = s.size(); s = s + b ; for (int i = 0; i < n; i++) { cout << (s[i] != s[i + 1] ? 1 : 0) << ; } ... |
///////////////////////////////////////////////////////////////////////////////
//
// Module: fifo_8x32.v
// Project: CPCI (PCI Control FPGA)
// Description: Small 8 x 32-bit FIFO
//
// Change history:
//
///////////////////////////////////////////////////////////////////////////////
module fifo_8x32(
... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> #pragma warning(disable : 4996) using namespace std; int T; int main() { cin >> T; while (T--) { int a, b, c; cin >> c >> b >> a; string s; if (a > 0) { s += 1 ; for (int i = 0; i < a; i++) s += 1 ; if (b > 0 && b % 2 == 1) { ... |
/*
* Milkymist VJ SoC
* Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* This program is distri... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1000 + 10; int ans[maxn]; bool build(int l, int r, int base, int top, int sum) { if (l > r) return true; int len = r - l + 1; int tmp = len * base; if (tmp > sum) return false; if (tmp == sum) { for (int i = l; i <= r; ++i)... |
#include <bits/stdc++.h> using namespace std; int loc[200000 + 10]; int n; int ans[4]; int fnext(int y) { int l = 1, r = n + 1, mid = (l + r) / 2; while (l < r) { if (loc[mid] <= y) l = mid + 1; else r = mid; mid = (l + r) / 2; } return mid; } int ok(int x... |
// Lab 4
// Created by David Tran
// Last Modified 02-05-2014
// extras
`timescale 1 ms /1 us
`include "full_adder.v"
// Testbench Module
module full_adder_tb (A, B, D);
output A, B, D;
reg A, B, D;
wire S, C;
reg t_A [5000:0];
reg t_B [5000:0];
reg t_D [5000:0];
reg t_clock;
reg [31:0] vectornum;... |
#include <bits/stdc++.h> using namespace std; int n, k, ad, a[444444], u[444444]; char str[11]; int getnum(char str[]) { int ret = 0, neg = -1, i = 1; if (str[0] != - ) { neg = 1; i = 0; } for (; str[i]; i++) { ret = ret * 10 + str[i] - 0 ; } ret *= neg; return re... |
module RAMDP(clock,reset,we,addr0,addr1,data_i,data_o0,data_o1);
parameter AddrSize = 8;
parameter DataSize = 8;
input wire clock;
input wire reset;
input wire we;
input wire [AddrSize-1:0] addr0;
input wire [Ad... |
// (c) Copyright 1995-2017 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not grant ... |
#include <bits/stdc++.h> using namespace std; long long rdtsc() { long long tmp; asm( rdtsc : =A (tmp)); return tmp; } inline int myrand() { return abs((rand() << 15) ^ rand()); } inline int rnd(int x) { return myrand() % x; } const int maxn = (int)1e5; char s[maxn + 1]; long long hs[maxn ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e6 + 7; const int inf = 0x3f3f3f3f; const long long INF = 0x3f3f3f3f3f3f3f3f; const int mod = 1000000007; const double eps = 1e-6; const double PI = acos(-1); int n, k, miu[N], Pown[N], sum[N]; int Power(int a, int b) { int ans = 1; ... |
module time_signal ( //Этот модуль описывает генератор сигнала времени, период времени пол-секунды.
//This module make a signal with a half-second period of time.
input wire clk,
input wire reset,
output wire time_out
);
reg [24:0] clk_number; //Счетчик тактов, на Waveshare CoreEP4CE10 установлен исто... |
//#############################################################################
//# Function: Synchronous FIFO #
//#############################################################################
//# Author: Andreas Olofsson #
... |
//
// Landing Gear Controller Behavioral Model
// Jenner Hanni <>
//
// 7-state Moore FSM with 5 inputs and 5 outputs.
//
module LandingGearController(Clock, Clear,
GearIsDown, GearIsUp, PlaneOnGround, TimeUp, Lever,
RedLED, GrnLED, Valve, Pump, Tim... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:13:00 04/24/2015
// Design Name: ALU_16
// Module Name: /media/BELGELER/Workspaces/Xilinx/processor/test_alu.v
// Project Name: processor
// Target Device:
// T... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo
// ============================================================
// File Name: asyn_256_139.v
// Megafunction Name(s):
// dcfifo
//
// Simulation Library Files(s):
//
// =======================================... |
#include <bits/stdc++.h> using namespace std; void ga(int N, int *A) { for (int i(0); i < N; i++) scanf( %d , A + i); } char s[64][64]; int N, M, x = int(1e9 + 1), X, y = int(1e9 + 1), Y; int main(void) { scanf( %d%d , &N, &M); for (int i(0); i < N; i++) scanf( %s , s[i]); for (int i(0); i <... |
#include <bits/stdc++.h> using namespace std; template <class T> inline void amin(T &first, const T &second) { if (second < first) first = second; } template <class T> inline void amax(T &first, const T &second) { if (first < second) first = second; } void solve() { int n; cin >> n; ... |
#include <bits/stdc++.h> using namespace std; vector<long long int> adj[101]; set<pair<long long int, long long int>> color[101]; long long int visited[101]; long long int x; void bfs(long long int a, long long int b, long long int c) { queue<long long int> q; q.push(a); while (!q.empty()) { ... |
`timescale 1 ns / 1 ps
module encoder_axi_m_v1_0 #
(
// Users to add parameters here
// User parameters ends
// Do not modify the parameters beyond this line
// Parameters of Axi Master Bus Interface M00_AXI
parameter integer C_M00_AXI_BURST_LEN = 16,
parameter integer C_M00_AXI_ID_WIDTH = 1,
... |
#include <bits/stdc++.h> using namespace std; const long long int M = 1e18 + 7; const long long int mod = 1e9 + 7; const long long int infi = LLONG_MAX; long long int i, j, ans, k, n, x, y, m, mymax = LLONG_MIN, mymin = LLONG_MAX, b, c, z, sum; int main() { long... |
#include <bits/stdc++.h> static const int MAXN = 5004; static const int ALPHA = 26; static const int MODULUS = 1e9 + 7; int n; char s[MAXN]; int binom[MAXN][MAXN]; int f[MAXN][ALPHA] = {{0}}, f_rowsum[MAXN] = {0}; void preprocess_binomials() { binom[0][0] = 1; for (int i = 1; i < MAXN; ++i) { ... |
module nmac_crc_check(
clk,
wr_clk,
reset,
in_pkt_wrreq,
in_pkt,
in_pkt_usedw,
in_valid_wrreq,
in_valid,
port_error,
out_pkt_wrreq,
out_pkt,
out_pkt_usedw,
out_valid_wrreq,
out_valid
);
input clk;
input wr_clk;
input reset;
input in_pkt_wrreq;
... |
#include <bits/stdc++.h> using namespace std; long long int rowblk[200005]; long long int colblk[200005]; long long int col[200005]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int l, n, i, j, k, m; cin >> n >> m; for (i = 1; i <= m; i++) { cin >> k >> l; ... |
#include <bits/stdc++.h> const int mod = 998244353; using namespace std; inline int read() { int f = 1, x = 0; char s = getchar(); while (!isdigit(s)) { if (s == - ) f = -1; s = getchar(); } while (isdigit(s)) { x = (x << 1) + (x << 3) + (s ^ 48), s = getchar(); } re... |
//*****************************************************************************
// DISCLAIMER OF LIABILITY
//
// This file contains proprietary and confidential information of
// Xilinx, Inc. ("Xilinx"), that is distributed under a license
// from Xilinx, and may be used, copied and/or disclosed only
// pursuant to the... |
#include <bits/stdc++.h> using namespace std; int gcd(int x, int y) { if (x == 0) return y; else return gcd(y % x, x); } bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); } bool sortbysize(string &s1, string &s2) { return s1.size() < s2.... |
#include <bits/stdc++.h> using namespace std; vector<int> pr; bool isp[1001]; void p() { memset(isp, true, sizeof isp); isp[0] = isp[1] = false; for (int i = 2; i < 1001; ++i) { if (!isp[i]) continue; pr.push_back(i); for (int j = 2 * i; j < 1001; j += i) isp[j] = false; } } ... |
#include <bits/stdc++.h> using namespace std; const int oo = (int)1e9 + 9; bool cmp(const pair<int, int> &a, const pair<int, int> &b) { return a.first < b.first; } int main() { int n, m; cin >> n >> m; vector<pair<int, int> > k(n); for (int(i) = (0); (i) < (n); ++(i)) { cin >> k[i].f... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.4
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1 ns / 1... |
module mytb
#(
parameter integer register_size = 32,
parameter integer register_count = 32,
parameter integer input_vector_size = 32,
parameter integer output_vector_size = 32,
parameter integer fifo_depth = 512,
parameter integer saddr_w = 24
)
();
// testbench controlled signals
... |
#include <bits/stdc++.h> using namespace std; const int maxn = 3e6 + 7; const int INF = 0x7fffffff; int n, m; struct DATA { int strid; int index; }; vector<DATA> vec; string str[maxn]; char ans[maxn]; bool cmp(DATA a, DATA b) { return a.index < b.index; } int main() { while (cin >> n) ... |
// This file is part of multiexp-a5gx.
//
// multiexp-a5gx is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is dis... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of ent_bb
//
// Generated
// by: wig
// on: Thu Apr 26 09:40:09 2007
// cmd: /home/wig/work/MIX/mix_0.pl -nodelta ../../verilog.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// $Author:... |
#include <bits/stdc++.h> using namespace std; template <class T> T min(T a, T b, T c) { return min(a, min(b, c)); } template <class T> T min(T a, T b, T c, T d) { return min(a, min(b, min(c, d))); } template <class T> T max(T a, T b, T c) { return max(a, max(b, c)); } template <class T... |
#include <bits/stdc++.h> using namespace std; string s; long long k, n; int index_1[(int)(1e6 + 5)], num = 0; void solve() { cin >> k >> s; n = s.size(); if (k == 0) { long long last = 0, ans = 0; for (int i = 0; i < n; i++) { if (s[i] == 0 ) last++; else { ... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { while (b) { a %= b; swap(a, b); } return a; } int main() { int t; cin >> t; while (t--) { long long x, y; cin >> x >> y; if (gcd(x, y) == 1) { cout << FINITE <<... |
#include <bits/stdc++.h> #pragma GCC optimize(2) const int inf = 0x3f3f3f3f, Inf = 0x7fffffff; const long long INF = 0x7fffffffffffffff; const double eps = 1e-8; unsigned int seed = 19260817; const unsigned int _RAND_MAX_ = 4294967295u; __inline__ __attribute__((always_inline)) unsigned int Rand() { r... |
/*
* In this example, the set and clr are both synchronous. This checks
* that this complex case is handled correctly.
*/
module main;
reg Q, clk, rst, set, clr;
(* ivl_synthesis_on *)
always@(posedge clk or posedge rst)
begin
if (rst)
Q <= 1'b0;
else if (clr)
Q <= 1'b0;
else if (set)
... |
`timescale 10ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:54:18 03/09/2016
// Design Name: mojo_top
// Module Name: C:/Users/matt/Documents/projects/mojo/i2c-eeprom/testbench_mojo_top.v
// Project Name: Mojo-Base
// Tar... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
// MBT 5/1/2017 Fast simulation mastercalibration module
//
// FPGA calibration module (example, only implements Phase 1 and dummy Phase 0,2,3)
//
// See BSG Source Synchronous I/O for specification of this.
//
// everything beginning with "out" is the output channel clock
// everything beginning with "in" is the inpu... |
// mbt 2-12-16
//
// this goes in silicon
//
//
`include "bsg_defines.v"
module bsg_chip_rocket #(
parameter num_channels_p = 4
, parameter channel_width_p = 8
, parameter enabled_at_start_vec_p = 0
... |
module fifo(
input w_clk,
input r_clk,
input we,
input [DATA_WIDTH - 1 : 0] d,
input re,
input [15 :0] mask,
output [DATA_WIDTH - 1 : 0] q,
output empty,
output full
);
parameter DATA_WIDTH = 1;
parameter ASYNC = 0;
wire [15:0] ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////////////////////////////////
`define ADDR_CONTROL_REG 'h0
`define ADDR_STATUS_REG 'h1
`define ADDR_DATA_REG 'h2
module axi_interface(
//CLK
... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
//
// Generated by Bluespec Compiler, version 2019.05.beta2 (build a88bf40db, 2019-05-24)
//
//
//
//
// Ports:
// Name I/O size props
// RDY_server_reset_request_put O 1 reg
// RDY_server_reset_response_get O 1
// read_rs1 O 64
// read_rs1_port2 ... |
#include <bits/stdc++.h> using namespace std; long long m; long long f(long long a) { long long res = 0; for (long long k = 2;; k++) { long long k3 = k * k * k; if (k3 > a) break; if (res > m - a / k3) return -1; res += a / k3; } return res; } int main() { cin >> m;... |
/*
* yosys -- Yosys Open SYnthesis Suite
*
* Copyright (C) 2012 Clifford Wolf <>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* T... |
//Legal Notice: (C)2010 Altera Corporation. All rights reserved. Your
//use of Altera Corporation's design tools, logic functions and other
//software and tools, and its AMPP partner logic functions, and any
//output files any of the foregoing (including device programming or
//simulation files), and any associate... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17:31:02 05/20/2014
// Design Name: mips32
// Module Name: F:/mips32/mips32test.v
// Project Name: mips32
// Target Device:
// Tool versions:
// Desc... |
//Legal Notice: (C)2014 Altera Corporation. All rights reserved. Your
//use of Altera Corporation's design tools, logic functions and other
//software and tools, and its AMPP partner logic functions, and any
//output files any of the foregoing (including device programming or
//simulation files), and any associated do... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; struct node { long long int u, v, w; } edge[N]; bool cmp(node a, node b) { return a.w < b.w; } long long int n, m, k, v, ans = 0; bool special[N]; long long int root[N]; long long int find_root(long long int x) { if (root[x] ... |
`timescale 1ns / 1ps
module Arkanoid(
input iCLK_50,
input btn_W, btn_E, btn_N, btn_S,
input [3:0] iSW,
input iROT_A, iROT_B,
output oVGA_R, oVGA_G, oVGA_B, oHS, oVS,
output [7:0] oLED
);
localparam BALL_NUM = 2;
localparam SHOT_NUM = 2;
reg clk_25;
wire middle, b_dis;
wire [4:0] p_speed;
wire [9:0] p_x, p_y, g_... |
#include <bits/stdc++.h> using namespace std; long long unsigned int countDivisors(long long unsigned int n) { long long unsigned int cnt = 0; for (long long unsigned int i = 1; i <= sqrt(n); i++) { if (n % i == 0) { if (n / i == i) ++cnt; else cnt += 2; } ... |
/* ltcminer_icarus.v copyright kramble 2013
* Based on https://github.com/teknohog/Open-Source-FPGA-Bitcoin-Miner/tree/master/projects/Xilinx_cluster_cgminer
* Hub code for a cluster of miners using async links
* by teknohog
*/
`include "../../source/sha-256-functions.v"
`include "../../source/sha256_transform.v"
... |
/*
Copyright (c) 2016-2018 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distri... |
module ascii (
input scan_ready,
input [7:0] scan_code,
output [7:0] ascii
);
// @todo: shift, alt etc
reg [7:0] r_ascii;
assign ascii = r_ascii;
reg keyup = 0;
always @(posedge scan_ready) begin
if (scan_code == 8'hf0) begin
keyup <= 1;
... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { int n, k; cin >> n >> k; vector<int> a(n, 0); for (int i = 0; i < n; i++) cin >> a[i]; vector<int> prev(n, 0); prev[0] = 0; ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; bool cmp(pair<ll, ll> a, pair<ll, ll> b) { return a.second > b.second; } bool cmp2(vector<ll> a, vector<ll> b) { return a.size() > b.size(); } int main() { ll n, m; cin >> n >> m; vector<pair<ll, ll>> vp(n); for (ll i = 0; i <... |
module state_control
#(
parameter BALL_NUM = 2,
parameter SHOT_NUM = 2
)
(
input clock, reset, start, btn_l, btn_r,
input [3:0] iSW,
input bm_ready,
input [3:0] bm_block,
input [9:0] p_x, p_y,
output reg [5:0] p_radius, b_radius,
output [BALL_NUM*10-1:0] o_bx, o_by,
output reg [BALL_NUM-1:0] b_active,
output... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2004 Xilinx, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//... |
// Accellera Standard V2.5 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2010. All rights reserved.
`include "std_ovl_defines.h"
`module ovl_odd_parity (clock, reset, enable, test_expr, fire);
parameter severity_level = `OVL_SEVERITY_DEFAULT;
parameter width = 1;
parameter property_... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; string s, p, r; s = 1 ; cin >> p; s = s + p; for (long long int i = 2; i < n - 1; i++) { if (n % i == 0) { p = s.substr(1, i); s = s.substr(i + 1, n); reverse(p.begin(), p... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 77, Mod = 1e9 + 7; int n, d1[N], d2[N], P1, P2, Mx, deg[N], p1[N], p2[N]; long long A; vector<pair<int, pair<int, int> > > R; vector<int> a[N]; void dfs(int v, int prev, bool t) { for (int u : a[v]) { if (u == prev) { cont... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.