text stringlengths 59 71.4k |
|---|
//*******************************************************************/
// $File: full_adder.v
// $Date: 2016-03-22
// $Revision: 1.0 $
// $Author: ENCLab
// $State: 1.0 - Initial Release
//*******************************************************************/
// $Change History:
//
// Revision 1.0 ENCL... |
/**
* 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... |
/**
* 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> using namespace std; const long long N = 1 << 17; const long long MN = N; long long s[MN]; long long m[MN]; long long rr[MN]; bool st[2 * N]; long long tme[2 * N]; long long lz[2 * N]; long long nn; vector<pair<long long, pair<long long, long long> > > manaFull[2 * N]; s... |
/**
* 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> using namespace std; const int NN = 1010; double first[NN], second[NN]; int main() { int n, a, b, c, d; cin >> n; for (int i = 0; i < n; i++) { scanf( %d%d%d%d , &a, &b, &c, &d); double s = a * a * d * d + c * c * b * b; first[i] = a * b * d * d / s; ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: AGH
// Engineer: Tomasz Kryjak
//
// Create Date: 11:29:28 10/28/2013
// Design Name:
// Module Name: tb_filter
// Project Name:
// Target Devices:
// Tool versions:
// Description... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 23:29:52 05/02/2013
// Design Name:
// Module Name: cond_sum
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
/... |
/**
* 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... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
/**
* 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> using namespace std; typedef struct _Box { int pos, weight; } Box; Box arr[200010]; long long int bit1[200010], bit2[200010]; const int mod = 1e9 + 7; int num; int getLowbit(int n) { return n & (-n); } void add(long long int* bitArr, int pos, long long int val, bool should... |
/*
* 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... |
module autoinst_signed
(/*AUTOARG*/
// Outputs
another_output2, another_output, an_outputpre, an_output2
);
/*AUTOOUTPUTEVERY*/
// Beginning of automatic outputs (every signal)
output [1:0] an_output2; // From u_fubar2 of autoinst_signed_fubar2.v
output signed [1:0] an_outputpre; // Fr... |
#include<bits/stdc++.h> using namespace std; int main(){ int t; cin >> t; while(t--){ int n; cin >> n; vector <int> a(n); int k = INT_MAX,z = -1; for(int i=0;i<n;i++){ cin >> a[i]; k = min(k,a[i]); if(k==a[i]){ z = i; } } cout << n-1 << endl; for(in... |
#include <bits/stdc++.h> using namespace std; const int maxn = (1e5) + 15; const int mod = (1e9) + 7; const int inf = (1e9) + 3; long long int n, k, ans; string s; long long int a[maxn]; int main() { ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); ; cin >> n >> k; for (int i ... |
// megafunction wizard: %CRC Compiler v9.1%
// GENERATION: XML
// ============================================================
// Megafunction Name(s):
// crc_check_altcrc
// ============================================================
// Generated by CRC Compiler 9.1 [Altera, IP Toolbench 1.3.0 Build 222]
... |
#include <bits/stdc++.h> using namespace std; int main() { int n, i, count; long long l, u; scanf( %d , &n); long long int a[n]; long long int h[n]; for (i = 0; i < n; ++i) { cin >> a[i] >> h[i]; } l = a[0]; h[n - 1] = 0; h[0] = 0; u = a[n - 1]; if (n > 1) { ... |
/* Author: ChinmayKarnik Time: 21:14:26 Date: 16-04-2021 */ #include<bits/stdc++.h> using namespace std; //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); //mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); typedef enum {BLACK,WHITE,GRAY}... |
#include <bits/stdc++.h> using namespace std; vector<long long> V[100005]; long long n; map<long long, long long> DP[100005]; long long concatHash(long long x, long long y) { return (x * 100005 + y) % 1000000007; } void answer(long long x) { cout << x; exit(0); } void fail() { cout << ... |
//Legal Notice: (C)2018 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... |
/**
* 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... |
module memory(input clk, input [31:0] idata, output [47:0] odata, input [15:0] addr, input [1:0] rw);
reg [7:0] data [0:2**16-1];
initial $readmemb("mem_init.txt", data);
always @(clk) begin
case (rw)
2'b01 : begin
data[addr] <= idata;
end
2'b10 : begin
{data[addr], data[addr + 1] } <= idata;
... |
// -- (c) Copyright 2010 - 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 property
// -- laws.
// --
// -- DISCLAIMER
// -- This disclaimer is not a... |
#include <bits/stdc++.h> using namespace std; template <typename T> void chkmax(T &x, T y) { x = x > y ? x : y; } template <typename T> void chkmin(T &x, T y) { x = x > y ? y : x; } const int INF = (1ll << 30) - 1; template <typename T> void read(T &x) { x = 0; bool f = 1; char c... |
module uniphy_status
#(
parameter WIDTH=32,
parameter NUM_UNIPHYS=2
)
(
input clk,
input resetn,
// Slave port
input slave_read,
output [WIDTH-1:0] slave_readdata,
// hw.tcl won't let me index into a bit vector :(
input mem0_local_cal_success,
input mem0_local_cal_fail,
... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2003 by Wilson Snyder.
// Also check that SystemC is ordering properly
// verilator lint_on IMPERFECTSCH
module t (/*AUTOARG*/
// Outputs
o1, o8, o16, o32, o64, o65, o128, o513... |
/******************************************************************************
* License Agreement *
* *
* Copyright (c) 1991-2009 Altera Corporation, San Jose, California, USA. ... |
/* Generated by Yosys 0.7 (git sha1 61f6811, gcc 5.4.0-6ubuntu1~16.04.4 -O2 -fstack-protector-strong -fPIC -Os) */
(* top = 1 *)
(* src = "var7_multi.v:2" *)
module var7_multi(A, B, C, D, E, F, G, valid);
wire _000_;
wire _001_;
wire _002_;
wire _003_;
wire _004_;
wire _005_;
wire _006_;
wire _007_;
... |
#include <bits/stdc++.h> using namespace std; long long power(long long b, long long e, long long m) { if (e == 0) return 1; if (e & 1) return b * power(b * b % m, e / 2, m) % m; return power(b * b % m, e / 2, m); } long long power(long long b, long long e) { if (e == 0) return 1; if (e & 1)... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 100000 + 10; const int INF = 1000000000; const int MOD = (int)(1e9) + 7; int main() { int n; cin >> n; int m = (1 << (n + 1)) - 1; vector<int> a(m + 10, 0); for (int i = 2; i <= m; i++) cin >> a[i]; vector<int> s(m + 10, 0)... |
/**
* 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> using namespace std; int a[26]; int A[26]; string s, t; int x1, x2; char c; int main() { cin >> s >> t; for (int i = 0; i < t.size(); i++) { c = t[i]; if (c > 96) a[c - 97]++; else A[c - 65]++; } for (int i = 0; i < s.size(); i++) ... |
/*
* 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 la... |
#include <bits/stdc++.h> using namespace std; void rs(int &x) { scanf( %d , &x); } void rsl(long long &x) { scanf( %I64d , &x); } void rsd(double &x) { scanf( %lf , &x); } void rss(char *str) { scanf( %s , str); } void ws(int &x) { printf( %d , x); } void wsl(long long &x) { printf( %I64d , x); } void... |
#include <bits/stdc++.h> const int mod = 1e9 + 7; const int MAXN = 1e6 + 5; template <typename _T> void read(_T &x) { x = 0; char s = getchar(); int f = 1; while (s < 0 || 9 < s) { f = 1; if (s == - ) f = -1; s = getchar(); } while ( 0 <= s && s <= 9 ) { x ... |
#include <bits/stdc++.h> using namespace std; auto random_address = [] { char *p = new char; delete p; return (uint64_t)p; }; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count() * (random_address() | 1)); const int INF = 1e9 + 5; struct edge { int a, b, color, in... |
/*
* 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; const int N = 1 << 22; int h, g; long long a[N]; vector<int> ans; int path[25]; long long pull(int u) { long long tp = a[u]; int cnt = 0; path[cnt++] = u; a[u] = 0; while ((u << 1) < (1 << h) && max(a[u << 1], a[(u << 1) | 1]) > 0) { ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; int sum = n; for (int i = n / 2; i >= 1; i--) { if (n % i == 0) { sum += i; n = i; } } cout << sum; return 0; } |
/*
* 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; inline long long fexp(long long b, long long e) { long long x = 1; for (; e; e >>= 1, b = (b * b) % (1000000007)) if (e & 1) x = (x * b) % (1000000007); return x; } long long n, k, ok, i, j, x; set<long long> S; signed main() { ios_base::sy... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyr... |
#include <bits/stdc++.h> using namespace std; int main() { int n, d, h; cin >> n >> d >> h; if (h * 2 < d) { cout << -1; return 0; } if (d == 1) { if (n >= 3) { cout << -1; return 0; } if (n == 2) { cout << 1 << << 2; return 0; ... |
#include <bits/stdc++.h> using namespace std; int n, m, a[111169], sum = 0; int main() { int x, y; cin >> n >> m; for (int i = (0); i < n; i += 1) cin >> a[i]; for (int i = (0); i < m; i += 1) { cin >> x >> y; sum += min(a[x - 1], a[y - 1]); } cout << sum; return 0; } |
/**
* 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> using namespace std; int main() { long long n; cin >> n; long long a[n], b[n]; for (long long i = 0; i < n; i++) { cin >> a[i] >> b[i]; } long long sum = 0; long long price = 99999; for (long long i = 0; i < n; i++) { price = min(price, b[i]); ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 3; struct tree { long long sum; int tag; int lc; int rc; } a[N << 1]; long long s[N]; int n, m, t = 1; long long ans; long long win; vector<pair<long long, long long> > other, change; inline int read() { int v = 0,... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Case Western Reserve University
// Engineer: Matt McConnell
//
// Create Date: 22:14:00 09/09/2017
// Project Name: EECS301 Digital Design
// Design Name: Lab #4 Project
// Module Name: ... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; const long long mod = 1e9 + 7; const long long N = 1e5 + 10; struct node { int ind, type, row, color; node(int a, int b, int c, int d) { ind = a; type = b; row = c; color = d; } }; bool comp(node ... |
#include <bits/stdc++.h> using namespace std; int n; int a[100010]; int s[100010]; int solve() { int ret = 0, top = 0; for (int i = 0; i < n; i++) { while (top && a[s[top]] < a[i]) --top; if (top) ret = max(ret, a[s[top]] ^ a[i]); s[++top] = i; } return ret; } int main() ... |
/**
* 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> using namespace std; const int INF = 0x7fffffff; int main() { int n; cin >> n; int sum = 0; int zero = 0; for (int i = 0; i < 2 * n; i++) { int x; scanf( %*d.%d , &x); sum += x; if (x == 0) zero++; } int ans = INF; for (int k = 0; k ... |
#include <bits/stdc++.h> using namespace std; int n, m, k; vector<int> cur; unordered_set<long long> bad; unordered_set<int> was; void err() { cout << impossible << endl; exit(0); } void go(int x) { cur.push_back(x); vector<int> g; for (auto it = was.begin(); it != was.end(); it++)... |
/**
* 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... |
/**
* 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... |
//
// File: zbt_6111.v
// Date: 27-Nov-05
// Author: I. Chuang <>
//
// Simple ZBT driver for the MIT 6.111 labkit, which does not hide the
// pipeline delays of the ZBT from the user. The ZBT memories have
// two cycle latencies on read and write, and also need extra-long data hold
// times around the clo... |
module AsymmetricBRAM_Xilinx(
CLK,
RADDR,
RDATA,
REN,
WADDR,
WDATA,
WEN
);
parameter PIPELINED = 'd 0;
parameter FORWARDING = 'd 0;
parameter WADDR_WIDTH = 'd 0;
parameter WDATA_WIDTH = 'd 0;
parameter RADDR_WIDTH = 'd 0;
parameter RDATA_WIDTH = 'd 0;
parameter MEMSIZE = 'd 1;
parameter REGISTERED = (PI... |
/****************************************
Branch
for MIST32 Processor
Takahiro Ito @cpu_labs
****************************************/
`include "core.h"
`default_nettype none
module execute_branch(
input wire [31:0] iDATA_0,
input wire [31:0] iDATA_1,
input wire [31:0] iPC,
input wire [4:0] iFLAG,
input w... |
#include <bits/stdc++.h> using namespace std; int main() { int x, x1, y, y1; char a, b; cin >> a >> y >> b >> y1; x1 = a - 96; x = b - 96; int counter = 0; string s[100000]; while (true) { if (x == x1 && y == y1) { break; } if (x > x1) { x1++; ... |
/*
* 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; long long gcd(long long x, long long y) { if (y == 0) return x; return gcd(y, x % y); } void O_o() { ios::sync_with_stdio(0); ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); } bool prime(int n, int i) { if (i == n) return true; ... |
//*****************************************************************************
// (c) Copyright 2009 - 2011 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
/... |
/**
* 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... |
// `define READ read_good
module top;
reg clk;
reg dout;
reg [7:0] data;
integer lp;
always #10 clk = ~clk; // Build a clock generator.
always @(negedge clk) dout = ~dout; // Build a bit stream.
initial begin
clk = 0;
dout = 0;
@(negedge clk);
for (lp=0; lp<4; lp=lp+1) begin
#0... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 12.07.2017 22:01:56
// Design Name:
// Module Name: t_ex
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; int n, first, second, a, b, m, d[(1 << 17) + 5], p[(1 << 17) + 5]; vector<int> g[(1 << 17) + 5]; bool check(int nod, int par, int del, int hg) { int kids = g[nod].size(); if (par) kids--; if (nod == del) { if (hg == ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, d, h, i, p, q, s; cin >> n >> d >> h; if (d > (2 * h)) { cout << -1 ; } else if ((d == 1) && (h == 1)) { if (n == 2) { cout << 1 2 ; } else { cout << -1 ; } } else if ((d == h))... |
#include <bits/stdc++.h> using namespace std; template <typename A, typename B> ostream& operator<<(ostream& out, const pair<A, B>& p) { out << ( << p.first << , << p.second << ) ; return out; } template <typename A, typename B> void printP(const pair<A, B>& p, const char* str = NULL) { if... |
////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2014, University of British Columbia (UBC); All rights reserved. //
// //
// Redistribution and use in source and binary forms, w... |
#include <bits/stdc++.h> using namespace std; bool bSearch(int* toys, int item, int from, int to) { if (from > to) return false; else { int midPoint = (from + to) / 2; if (item < toys[midPoint]) return bSearch(toys, item, from, midPoint - 1); else if (item == toys[midPoint]) ... |
//Legal Notice: (C)2015 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... |
#include <bits/stdc++.h> using namespace std; const int N = 4e5 + 10; int a[N]; int vis[N]; int sum[4 * N]; void up(int id, int l, int r, int pos, int val) { if (l == r) { sum[id] = val; return; } int mid = l + r >> 1; if (pos <= mid) up(id << 1, l, mid, pos, val); else... |
#include <bits/stdc++.h> using namespace std; inline long long read() { register long long x = 0, f = 1; register char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) f = -1; c = getchar(); } while (c >= 0 && c <= 9 ) x = x * 10 + c - 48, c = getchar(); return x * f;... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2019 by Todd Strader.
// SPDX-License-Identifier: CC0-1.0
// Test for trace file interface aliasing
typedef struct packed {
integer val100;
integer val200;
} struct_t;
... |
`timescale 1ns/1ps
module video_to_block_fifo #(
parameter BUFFER_SIZE = 9
)(
input clk,
input rst,
input i_enable,
input i_video_hsync,
input i_video_sof_stb,
input [7:0] i_red,
input [7:0] i_green,
input [7:0] i_blue... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: R_SEQ.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ======================... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); long long n, k; cin >> n >> k; if (k >= n / 2) cout << n * (n - 1) / 2; else cout << n * (n - 1) / 2 - (n - 2 * k) * (n - 2 * k - 1) / 2; return 0; } |
module opc5lscpu( input[15:0] din, input clk, input reset_b, input int_b, input clken, output vpa, output vda, output[15:0] dout, output[15:0] address, output rnw);
parameter MOV=4'h0,AND=4'h1,OR=4'h2,XOR=4'h3,ADD=4'h4,ADC=4'h5,STO=4'h6,LD=4'h7,ROR=4'h8,NOT=4'h9,SUB=4'hA,SBC=4'hB,CMP=4'hC,CMPC=4'hD,BSWP=4'hE,PSR=4'... |
/*
* 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... |
module wallace(x,y,p);
input [7:0] x,y;
output [15:0] p;
wire [6:0] ip1;
wire [7:0] ip2,ip3,ip4,ip5,ip6,ip7,ip8,si,iip;
wire [6:0] s1,s2,s3,s4,s5,s6;
wire [7:0] c1,c2,c3,c4,c5,c6,c7;
wire c;
// first AND array
and fi1(p[0],y[0],x[0]);
and fi2(ip1[0],y[0],x[1]);
and fi3(ip1[1],y[0],x[2]);
and fi4(ip1[2],y[0],x[3]);
and ... |
#include <bits/stdc++.h> using namespace std; ifstream fin( lol.in ); ofstream fout( lol.out ); char c; int m[10][10], ok; int main() { ios::sync_with_stdio(false); for (int i = 1; i <= 6; ++i) { m[1][i] = m[6][i] = 100; m[i][1] = m[i][6] = 100; } for (int i = 2; i <= 5; ++i) { ... |
#include <bits/stdc++.h> using namespace std; typedef struct graph { list<int> edges[1001]; } graph; void dfs(graph *g, int i, int group[], int gn) { for (list<int>::iterator it = g->edges[i].begin(); it != g->edges[i].end(); it++) { if (group[*it] == -1) { group[*it] = gn; ... |
#include <bits/stdc++.h> using namespace std; int n, sz[1005], lab[1005], cur = 1, cur2, f = 1; vector<int> v[1005]; int getsz(int node, int p) { sz[node] = 1; for (int u : v[node]) { if (u != p) sz[node] += getsz(u, node); } return sz[node]; } int find(int node, int p) { for (int ... |
#include <bits/stdc++.h> const int N = 1000005; std::vector<int> e[N]; int a[N], n, m, x, y, r[N], c[N], id[N], cnt, cnt2, s[N], vis[N]; void dfs(int x) { if (vis[x]) return; vis[x] = 1; for (auto u : e[x]) { dfs(u); a[x] |= a[u]; } } int main() { scanf( %d%d , &n, &m); f... |
/*
* Copyright (c) 2000 Stephen Williams ()
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* ... |
#include <bits/stdc++.h> using namespace std; bool flag = false; int n, m, K; int up[2005][2005], down[2005][2005]; int Find(int p[], int x) { return p[x] != x ? p[x] = Find(p, p[x]) : x; } void check(int x, int y, int i, int &g, int &h, int &L) { if (i < 1 || i > n) return; int j; j = Find(up[i... |
#include <bits/stdc++.h> const int N = 100005; using namespace std; int n, a[N], b[N], flag[N]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &a[i]), b[i] = 1; int now = a[n]; for (int i = n - 1; i >= 1; i--) { if (now > a[i]) b[i] = -1, flag[i] = 1, now = ... |
#include <bits/stdc++.h> using namespace std; int readInt() { bool minus = false; int result = 0; char ch; ch = getchar(); while (true) { if (ch == - ) break; if (ch >= 0 && ch <= 9 ) break; ch = getchar(); } if (ch == - ) minus = true; else result ... |
#include <bits/stdc++.h> using namespace std; const int MAX = 1e5 + 5; const int mod = 1e9 + 7; long long n, k, arr[MAX], ans = 0; int main(int argc, char** argv) { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> k; if (n == 1) { cout << 0; exit(0); } bool mode... |
#include <bits/stdc++.h> const long double eps = 0.00000001; const long long MOD = 1e9 + 7; const double PI = 3.141592653589793238463; using namespace std; long long ans; int was[1010][1010]; int main() { fflush(stdin); cout << fixed, cout.precision(18); ios_base::sync_with_stdio(false); i... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline T Abs(T a) { return a > 0 ? a : -a; } void split(string s, string seps, vector<string> &res, bool doEmpty = false) { int start = 0; res.clear(); for (int i = 0; i < s.size(); i++) { if (seps.find(s[i]) != string::... |
#include <bits/stdc++.h> using namespace std; vector<int> a[2222]; int dis[2222]; int main() { for (int i = 0; i < 2222; ++i) dis[i] = -1; dis[0] = 0; int n, m; cin >> n >> m; for (int i = 0; i < n; ++i) for (int j = 0; j < m; ++j) { char c; cin >> c; if (c == ... |
/*
Andrew Mattheisen
Zhiyang Ong
EE-577b 2007 fall
VITERBI DECODER
spd module
@modified by Zhiyang Ong on November 1, 2007
The output out signal must be of the data type reg
I had to reallocate this data-type reg.
Correction: It is relabelled to the wire data type since
it is not used again, or explicitly... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { int n, m; cin >> n >> m; vector<long long> v(n); for (int i = 0; i < n; i++) { string s; cin >> s; long long a =... |
// Controller module
// Copyright 2010 University of Washington
// License: http://creativecommons.org/licenses/by/3.0/
// 2008 Dan Yeager
// This is the high level smarts of the RFID tag.
// It decides if and what to send upon a
// packet complete signal from the rx module.
// If we should transmit, it starts up th... |
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >> n; getline(cin, s); while (n--) { getline(cin, s); bool L = false, M = false; if (s.length() < 5) { cout << OMG>.< I don t know! << endl; continue; } if (s.substr(0,... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2004 Xilinx, Inc.
// All Right Reserved.
///////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor : Xilinx
// \ \ \/ Version : 8.1... |
/*******************************************************************************
* This file is owned and controlled by Xilinx and must be used solely *
* for design, simulation, implementation and creation of design files *
* limited to Xilinx devices or technologies. Use with non-Xilinx ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.